(function(){









if( window == top ){
        

        
        similarproducts.b.site="https://www.superfish.com/ws/";
        similarproducts.b.ip="1.1.1.1";
        similarproducts.b.userid=similarproducts.b.qsObj.userId;
        similarproducts.b.appVersion=similarproducts.ver.calcAppVersion();
        similarproducts.b.hcAppScriptsVersion="14.08.14.04";
        similarproducts.b.hcWhiteListVersion="14.08.11.01";
        similarproducts.b.clientVersion=(similarproducts.b.qsObj.clientVersion || similarproducts.b.qsObj.dlsource);

        similarproducts.b.wlVersion="14.08.31.1";
        similarproducts.b.wlOldVersion="6.15";
        similarproducts.b.wlDestDate="2014.09.02";
        similarproducts.b.wlStartDate="2014.08.31";

        similarproducts.b.cpnVersion="36";
        similarproducts.b.cpnOldVersion="35";
        similarproducts.b.cpnDestDate="2013.04.14";
        similarproducts.b.cpnStartDate="2013.04.08";

        similarproducts.b.cdnUrl="http://ajax.googleapis.com/ajax/libs/dojo/1.5.1/";
        similarproducts.b.pluginDomain="https://www.superfish.com/ws/";
        similarproducts.b.dlsource="sfrvzr";
        similarproducts.b.sgt=(similarproducts.b.qsObj.sgt || "");
        similarproducts.b.statsReporter=(similarproducts.b.qsObj.statsReporter == "true");
        similarproducts.b.CD_CTID=similarproducts.b.qsObj.CTID;
        similarproducts.b.w3iAFS=(similarproducts.b.qsObj.w3iAFS || "");
        

similarproducts.b.images='sfrvzr';
similarproducts.b.partnerCustomUI=0;
similarproducts.b.bl='|cars.com|newcars.com|auto.com|pickuptrucks.com|pinkvelvetpass.com|pornhub.com|web.de|blinkx.com|start.toshiba.com|revouninstaller.com|shush.se|huffingtonpost.com|zoom.com|widdit.com|nation.com|zoo.com|dogpile.com|searchcompletion.com|certified-toolbar.com|autocompletepro.com|protectedsearch.com|spiegel.de|minted.com|delta-homes.com|redcross.org|redcross.ca|drk.de|croix-rouge.fr|redcross.org.uk|speedbit.com|loopnet.com|snap.do|zoom.br|stackoverflow.com|stackexchange.com|laredoute.fr|hulu.com|shopzilla.com|shopzilla.com.br|shopzilla.ca|shopzilla.co.uk|shopzilla.de|shopzilla.fr|bizrate.com|bizrate.com.br|bizrate.ca|bizrate.co.uk|bizrate.de|bizrate.fr|beso.com|beso.com.br|beso.ca|beso.co.uk|beso.de|beso.fr|prixmoinscher.com|spardeingeld.de|robotoatmeal.com|tada.com|tada.co.uk|abril.com.br|terra.com.br|ig.com.br|onofreeletro.com.br|blogspot.com.br|hotelurbano.com.br|peixeurbano.com.br|gov.br|wikipedia.org|lesaubaines.com|bloomberg.com|delta-search.com|architecte3d.com|blogger.com|zazzle.com|mycouponbuddy.com|leobell.net|fotosnaturaleza.es|www.easymobility.co.uk|www.theground-up.com|www.thegroundup-ssi.com|portail.dartybox.com|gadgets-toons-cadeaux.com|mercadolibre.com.ar|mercaodlibre.com.co|mercadolibre.com.cr|mercadolibre.com.cl|mercadolibre.com.do|mercadolibre.com.ec|mercadolibre.com.mx|mercadolibre.com.pa|mercadolibre.com.pe|mercadolibre.com.pt|mercadolibre.com.uy|mercadolibre.com.ve|abajournal.com|alexa.com|autotrader.com|baidu.com|bedandbreakfast.com|bernadettelivingston.com|beso.com|birdviewprojects.com|bizrate.com|booking.com|cam4.com|cj.com|cnn.com|crunchyroll.com|cvsphoto.com|dcinside.com|deviantart.com|drudgereport.com|facebook.com|flickr.com|furniture-quest.com|history.com|hotmail.com|imdb.com|imvu.com|linkedin.com|lolhehehe.com|lowpriceshopper.com|microsoft.com|msn.com|myspace.com|netflix.com|nytimes.com|pandora.com|picasa.com|pinterest.com|politico.com|polybags4less.com|pricegrabber.com|publicstorage.com|qq.com|rue89.com|salon.com|searchenginewatch.com|sfgate.com|shopzilla.com|shutterfly.com|sommerfrischeamsemmering.wg.vu|spardeingeld.com|techcrunch.com|usamm.com|verizon.com|venturebeat.com|westsiderentals.com|wired.com|yankodesign.com|yahoo.com|youtube.com|';
similarproducts.b.addBl='|123inkjets.com|24hourfitness.com|4inkjets.com|6pm.com|att.com|adobe.com|adorama.com|shop.com|advanceautoparts.com|audible.com|autopartswarehouse.com|avenue.com|backcountry.com|basspro.com|bestbuy.com|bodenusa.com|brooksbrothers.com|carbonite.com|celebrateexpress.com|chainlove.com|chegg.com|competitivecyclist.com|dell.com|departmentofgoods.com|dogfunk.com|endless.com|ftd.com|footsmart.com|gamefly.com|gamehouse.com|gap.com|garmin.com|golfnow.com|hp.com|snapfish.com|hsn.com|harryanddavid.com|homedecorators.com|homedepot.com|lenovo.com|lightinthebox.com|lowes.com|musiciansfriend.com|newegg.com|overstock.com|petco.com|qvc.com|quill.com|rei.com|shindigz.com|shoebuy.com|shopbop.com|skinstore.com|store.com|sony.com|staples.com|strawberrynet.com|tirerack.com|harryanddavid.com|footsmart.com|plaingreenloans.com|fansedge.com|hottopic.com|ecampus.com|gotomypc.com|buycostumes.com|keen.com|crucial.com|altrec.com|blair.com|smoothfitness.com|callawaygolfpreowned.com|fonts.com|perfumania.com|graveyardmall.com|wbshop.com|framesdirect.com|lids.com|fragrancex.com|tracfone.com|cyberlink.com|golfsmith.com|trendmicro.com|ingdirect.com|shoemall.com|fossil.com|autoanything.com|shopperschoice.com|josbank.com|bodycandy.com|fanatics.com|coffeeforless.com|marylandsquare.com|oakley.com|softsurroundings.com|realcyclist.com|roxio.com|entirelypets.com|lens.com|steepandcheap.com|stamps.com|shoeline.com|vitaminshoppe.com|masoneasypay.com|rosettastone.com|cooking.com|shopjustice.com|dog.com|bird.com|fish.com|masseys.com|thinkgeek.com|venturebeat.com|whiskeymalitia.com|polybags4less.com|pricegrabber.com|zappos.com|sears.com|';
similarproducts.b.cdnJQUrl='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
similarproducts.b.arrFill='#dadee2';
similarproducts.b.arrBorder='#356595';
similarproducts.b.supportedBy="Better Deals";
similarproducts.b.shareMsgProd='Better Deals';
similarproducts.b.shareMsgUrl='www.superfish.com';
similarproducts.b.inimg=1;
similarproducts.b.theme=2;
similarproducts.b.abTheme=1;
similarproducts.b.inimgSrp=1;
similarproducts.b.txtExtr=false;
similarproducts.b.psuSupportedBy=1;
similarproducts.b.psuSupportedByText='Better Deals';
similarproducts.b.psuSupportedByTitle='Click for More Information';
similarproducts.b.inimgSupportedByLink='';
similarproducts.b.isPublisher=false;
similarproducts.b.multiImg=0;
similarproducts.b.ignoreWL=0;
similarproducts.b.icons=1;
similarproducts.b.spLogoClick=0;
similarproducts.b.sfDomain='www.superfish.com';
similarproducts.b.partnerLogoLink='javascript:similarproducts.util.bCloseEvent(document.getElementById(\"infoBtn\"), 2);';
similarproducts.b.partnerFooterLink='javascript:similarproducts.util.bCloseEvent(document.getElementById(\"infoBtn\"), 2);';
similarproducts.b.searchget=1;
similarproducts.b.merchantSearchget=1;
similarproducts.b.sgAllenby=0;
similarproducts.b.stDt=1;
similarproducts.b.rvDt=100;
similarproducts.b.sgSupportedByLink='javascript:void(0);';
similarproducts.b.sgPrompt='Better Deals will be <br>disabled for';
similarproducts.b.sgSleepTime=86400;
similarproducts.b.sgSleepText='24 hours';
similarproducts.b.lgWi='280';
similarproducts.b.lgHe='43';
similarproducts.b.lgTo='-11';
similarproducts.b.drWi='216';
similarproducts.b.drLf='';
similarproducts.b.iButtonLink='';
similarproducts.b.sgIc=1;
similarproducts.b.noIcon=0;
similarproducts.b.slideup=0;
similarproducts.b.slideupSrp=0;
similarproducts.b.slideupAndInimg=0;
similarproducts.b.iiHv=0;
similarproducts.b.secMd='1';
similarproducts.b.sgSupportedByText='Better Deals';
similarproducts.b.cpn='1';
similarproducts.b.topPpc=0;
similarproducts.b.cpnWLver='35';
similarproducts.b.cpnWLcb='SF_cpnWlCb';
similarproducts.b.rvWLver='3';
similarproducts.b.rvWLcb='SF_isRvURISupported';
similarproducts.b.lp=0;
similarproducts.b.sfsrp=0;
similarproducts.b.redIcon=0;
similarproducts.b.whiteIcon=0;
similarproducts.b.largerIi=1;
similarproducts.b.reportNoneSite=0;
similarproducts.b.logoText='Better Deals';
similarproducts.b.noPopup=0;
similarproducts.b.inImgDt=1; 
similarproducts.b.at=0; 
similarproducts.b.pipLinksExists='1234amazon.com1234|1234pgpartnet.com1234|1234dealtime.com1234|1234ebay.com1234';
similarproducts.b.pipKeywordInDomain='store1234|buy1234|estore';
similarproducts.b.pipBrandInDomain='little pony equestria girls|noise cancelling headphones|american eagle outfitters|samsung galaxy grand duos|consider yourself warned|cyberpowerpc gamer ultra|dolce gabbana light blue|the north face women\'s|tommy hilfiger women\'s|portable air conditioner|calvin klein sportswear|international harvester|calvin klein women\'s|the north face men\'s|tommy hilfiger men\'s|under armour women\'s|versace bright crystal|streaming media player|automatic pool cleaner|floor standing speaker|flat screen television|calvin klein eternity|calvin klein euphoria|dolce gabbana the one|l oreal professionnel|new balance women\'s|peg perego john deere|spongebob squarepants|scientific calculator|calvin klein men\'s|dr martens women\'s|fred perry women\'s|international silver|samsung stratosphere|sarah jessica parker|under armour men\'s|universal housewares|visual land prestige|micro sd memory card|digital media player|home theater seating|billabong women\'s|caterpillar men\'s|christian louboutin|columbia sportswear|cook\'s essentials|creative recreation|hollister women\'s|lululemon athletica|marc by marc jacobs|metropolitan vacuum|mr\. clean autodry|new balance men\'s|patagonia women\'s|powers collectibles|salvatore ferragamo|tommy hilfiger boys|external hard drive|wayfarer sunglasses|home theater system|the legend of zelda|call of duty ghosts|gps bluetooth phone|notebook hard drive|american ironhorse|calvin klein jeans|carhartt women\'s|christian audigier|dr martens men\'s|everlast pro style|fred perry men\'s|garmin streetpilot|hitachi magic wand|jessica mcclintock|louisville slugger|oriental furniture|samsung brightside|scarlett johansson|simmons beautyrest|sylvester stallone|thomas and friends|yves saint laurent|aviator sunglasses|bluetooth keyboard|all in one printer|electric fireplace|refurbished  laptop|cabinet organizers|garage door remote|flat panel monitor|american standard|avon skin so soft|barnes noble nook|benefit cosmetics|billabong men\'s|converse all star|corsair vengeance|denzel washington|durango women\'s|flow snowboarding|freestyle men\'s|french connection|fruit of the loom|garmin forerunner|hollister men\'s|invicta women\'s|j�germeister|lacoste women\'s|lego super heroes|littlest pet shop|maclaren stroller|magellan roadmate|majestic athletic|microsoft surface|mountain hardwear|mountain plumbing|optimum nutrition|patagonia men\'s|progress lighting|ralph lauren polo|rampage women\'s|samsung captivate|samsung intensity|samsung transform|seagate barracuda|shirley hollywood|things remembered|toshiba satellite|baby girl clothes|navigation system|plants vs zombies|adidas women\'s|alpinestars tech|american apparel|arroyo craftsman|asus transformer|baldwin hardware|bugaboo cameleon|canon imageclass|carhartt men\'s|chicago metallic|clarks women\'s|continental elec|diesel women\'s|dymo labelwriter|elizabeth taylor|epson expression|ermanno scervino|fossil women\'s|fujitsu lifebook|g star women\'s|general electric|giuseppe zanotti|griffin survivor|hotpoint ariston|hubbardton forge|jeffrey campbell|jennifer aniston|kichler lighting|kraft industrial|lenovo essential|liberty hardware|microsoft office|miranda cosgrove|mizuno women\'s|mr clean autodry|norton antivirus|original penguin|outdoor research|reebok women\'s|rockford fosgate|southern comfort|speedo women\'s|stella mccartney|urban outfitters|victoria beckham|victorias secret|volcom women\'s|wrangler men\'s|bridesmaid dress|desktop computer|baby boy clothes|diamond earrings|cardigan sweater|wireless speaker|motorcycle boots|universal remote|anniversary ring|bathroom cabinet|streaming player|cashmere sweater|motorcycle pants|christening gown|activity tracker|car audio system|personal blender|access lighting|acer chromebook|acer travelmate|adobe photoshop|adrianna papell|armani exchange|asics women\'s|asus sabertooth|babette holland|badgley mischka|ballard designs|banana republic|bandai tamashii|bare escentuals|border concepts|briggs stratton|burberry london|charlotte russe|chinese laundry|coldwater creek|compaq presario|cook essentials|corsair carbide|cutter and buck|elizabeth arden|engagement ring|epson workforce|flow snowboards|garmin approach|garnier fructis|gillette fusion|gwyneth paltrow|harley davidson|htc thunderbolt|hudson lighting|invicta men\'s|invisibleshield|jessica simpson|johnson johnson|kodak easyshare|lacoste men\'s|levis women\'s|mach speed trio|michael antonio|motorola photon|nautica men\'s|nike revolution|olympus m zuiko|panasonic viera|samsung exhibit|samsung gravity|seiko women\'s|skin industries|source naturals|stuart weitzman|timex women\'s|Toys \"r\" us|vanessa hudgens|walking cradles|weight watchers|western digital|western-digital|patio furniture|washing machine|laptop computer|bangle bracelet|silver necklace|wireless router|ballet slippers|tennis bracelet|convection oven|satellite radio|computer memory|radio cd player|rubber bracelet|maternity jeans|activity walker|advent calendar|hawaiian shirts|adidas men\'s|adriana papell|american range|angelina jolie|audio technica|audrey hepburn|beach handbags|betsey johnson|bradley cooper|braun series 7|britney spears|charm bracelet|christian dior|clarks men\'s|colonial mills|combi stroller|comfort choice|dell precision|diesel men\'s|dkny women\'s|emporio armani|fila women\'s|fossil men\'s|g star men\'s|gabriella gold|galaxy express|george foreman|giorgio armani|graham spencer|homer laughlin|htc incredible|hurricane toys|jennifer lopez|jessica howard|jessica london|johnnie walker|js collections|justice design|kate middleton|keen women\'s|kim kardashian|kingston brass|laredo men\'s|le coq sportif|lego minecraft|lego star wars|lilly pulitzer|lowrance elite|marilyn monroe|martha stewart|maxim lighting|mens wearhouse|mickey friends|microsoft zune|miller welders|mizuno men\'s|motorola droid|nanette lepore|nature\'s way|nautica voyage|nike women\'s|olympus stylus|onitsuka tiger|patek philippe|philips gogear|power acoustik|powerwarehouse|puma women\'s|reebok men\'s|reebok ziglite|rubies costume|sabrina silver|samsung admire|samsung infuse|samsung series|shock absorber|speck products|speedo men\'s|swatch men\'s|the north face|thierry mugler|tissot men\'s|tommy hilfiger|toshiba thrive|velocity micro|velvet eyewear|volcom juniors|volcom men\'s|vacuum cleaner|leather jacket|cocktail dress|speaker system|air compressor|sneakers shoes|laptop battery|cordless phone|fm transmitter|food processor|car dvd player|flat screen tv|chain bracelet|cordless drill|heart necklace|capri leggings|laptop charger|vanity cabinet|pearl bracelet|backless dress|sd memory card|infinity scarf|satellite dish|projector lamp|bass amplifier|tanzanite ring|football pants|acer predator|alex evenings|allen edmonds|alyssa milano|american girl|anne hathaway|anthropologie|asics men\'s|asus republic|austin healey|baby einstein|bcbgeneration|beanie babies|betty crocker|betty jackson|brass accents|burberry brit|callaway golf|casual canine|chicco keyfit|cooler master|corsair hydro|david beckham|dell inspiron|dell latitude|diamond audio|digital rebel|dolce gabbana|dooney bourke|dora explorer|eileen fisher|epson artisan|fashion forms|fisher paykel|galaxy player|garmin oregon|genetic denim|gibson guitar|herman miller|horizon hobby|htc butterfly|htc sensation|intel celeron|intel pentium|jason statham|jeremy renner|jm collection|johnny walker|joseph joseph|juicy couture|justin bieber|kylie minogue|l oreal paris|lauren conrad|lee women\'s|levis juniors|levis men\'s|liz claiborne|louis garneau|louis vuitton|mark wahlberg|mercedes benz|mercedes-benz|metal mulisha|mischa barton|mitchell ness|monster cable|motorola defy|motorola xoom|neiman marcus|newport brass|nvidia quadro|olympus evolt|paul fredrick|price pfister|primo viaggio|ros hommerson|royal doulton|royal enfield|saint laurent|samsung focus|samsung rugby|sandisk sansa|seiko men\'s|sesame street|sofia vergara|sony ericsson|sony handycam|summer infant|sunshine kids|tech lighting|the body shop|thomas engine|timex men\'s|toshiba tecra|toys\"r\"us|true religion|ugg australia|villeroy boch|world jerseys|yankee candle|running shoes|wedding dress|messenger bag|ink cartridge|hoop earrings|graphics card|soccer jersey|paintball gun|heart pendant|bathroom sink|gaming laptop|car amplifier|car subwoofer|digital piano|gold bracelet|womens blouse|dlp projector|lcd projector|vintage dress|video monitor|leather pants|speaker cable|flat panel tv|laptop memory|label printer|cabinet knobs|subwoofer box|amethyst ring|womens blazer|speaker stand|car cd player|big screen tv|pearl earring|acer gateway|acer veriton|acqua di gio|aston martin|asus maximus|asus rampage|babyliss pro|bakers pride|bareminerals|bcbgmaxazria|beverage air|black decker|brylane home|build a bear|build-a-bear|calvin klein|canada goose|canon selphy|cheap monday|chuck norris|creative zen|crown verity|dale tiffany|daniel craig|dc women\'s|digital blue|donna morgan|dr\. pepper|epson stylus|escort radar|estee lauder|fila men\'s|fisher price|fisher-price|franco sarto|garmin astro|google nexus|gucci guilty|harry potter|helly hansen|htc wildfire|hush puppies|jagermeister|james franco|just cavalli|keen men\'s|kenneth cole|l\'occitane|laura ashley|lbl lighting|lebron james|lego friends|levi strauss|lg extravert|lg intuition|little tikes|maggy london|mariah carey|melissa doug|metal fusion|michael kors|mickey mouse|minka lavery|minute mirth|mountain dew|murray feiss|neff men\'s|nescaf�|nike men\'s|nintendo 3ds|pacific play|paco rabanne|pentax optio|petit bateau|pierce arrow|polly pocket|pottery barn|puma men\'s|quietcomfort|rachel pally|rachel weisz|ralph lauren|raquel welch|ravensburger|safety first|sally hansen|samsung ativ|selena gomez|silver jeans|simple shoes|smith wesson|sonia jewels|sony walkman|spalding nba|steve madden|swiss legend|taylor swift|techno earth|thomas train|thrustmaster|timex unisex|tommy bahama|tomtom start|travel smith|tri mountain|turtle beach|under armour|vera bradley|vince camuto|westinghouse|wicked audio|xerox phaser|summer dress|pencil skirt|denim jacket|coffee maker|water filter|water heater|kitchen sink|boxer briefs|sports watch|hiking boots|stud earring|air purifier|track jacket|gps receiver|winter boots|dvd recorder|room divider|promise ring|clutch purse|belt buckles|shower caddy|speaker wire|gold pendant|sweater coat|sport jacket|laptop parts|marine radio|vintage ring|rainbow loom|floor puzzle|wifi booster|key necklace|turkey fryer|girls hoodie|2\(x\)ist|acer aspire|aeropostale|all mankind|alpinestars|american dj|angry birds|apple ibook|armani code|astromaster|asus taichi|bali blinds|beanie boos|ben sherman|birkenstock|bridgestone|broilmaster|brother mfc|brylanehome|bugaboo bee|canon vixia|casio gzone|caterpillar|celine dion|chris evans|corningware|crown royal|dell streak|dell studio|dell vostro|derek jeter|diamondback|dior addict|donna karan|easy spirit|eddie bauer|ellen tracy|emma watson|evan picone|ever pretty|faded glory|fisherprice|free people|galaxy note|garmin edge|garmin nuvi|garmin zumo|gary fisher|hal leonard|hello kitty|high sierra|hobby lobby|hp pavilion|hp touchpad|htc mytouch|htc rezound|htc windows|joy carpets|js boutique|kenroy home|lamborghini|lane bryant|lee men\'s|lego marvel|lg smart tv|lg spectrum|lifefactory|lite source|little pony|lrg men\'s|lucky brand|marc jacobs|miley cyrus|miraclesuit|montegrappa|music skins|my oilcloth|naturalizer|nature made|new balance|nickelodeon|nicki minaj|nike legend|nordic ware|nudie jeans|office star|olympus pen|pearl izumi|perry ellis|pfaltzgraff|planet bike|plantronics|playstation|powerseeker|primal wear|puma unisex|purely pets|quicksilver|radio flyer|range kleen|rider jeans|rolls royce|ross simons|sam edelman|samsung sch|savoy house|spring step|springfield|steelseries|stride rite|taylor made|thermaltake|thinkcentre|tiger woods|trans globe|ultra force|urban decay|vulcan hart|weathertech|wii console|winnie pooh|wonderworld|xhilaration|yves rocher|zip heaters|zoe saldana|ankle boots|lcd monitor|pumps shoes|camera case|printer ink|shower head|clock radio|denim skirt|mini fridge|tv receiver|plasma hdtv|slow cooker|cable modem|vacuum pump|laser toner|wifi router|laptop skin|vintage bag|wine cellar|tv speakers|speaker bar|abu garcia|accumulair|adirondack|affliction|ainol novo|alfa romeo|alto shaam|amd athlon|amd fusion|amd phenom|amd turion|ann taylor|anne klein|aqua brass|arctic cat|baby bjorn|babyvision|balenciaga|blackberry|body glove|bombardier|boonie hat|boss black|broil mate|brother hl|bumbleride|campagnolo|cannondale|canon ixus|care bears|case logic|char broil|coby kyros|cold steel|comfy feet|cyber shot|cyberpower|dc men\'s|dirt devil|dkny jeans|dr martens|duragadget|electrolux|elton john|emma stone|ex officio|fox racing|fred perry|frigidaire|fruit loom|galaxy ace|galaxy tab|glastender|grillworks|guidecraft|hama beads|heavy duty|heidi klum|hot wheels|hp spectre|htc desire|hulk hogan|ideacentre|intel core|intel xeon|jack spade|jelly bean|jimmy choo|joes jeans|john deere|jvc everio|karen kane|kate spade|kensington|kikkerland|kitchenaid|koenigsegg|koolertron|kryptonite|kuhn rikon|l occitane|lamisil at|land rover|lange boot|lazy susan|le creuset|leatherman|leg avenue|lego duplo|lesportsac|levis boys|lg connect|lg marquee|lg optimus|maybelline|mega bloks|minnetonka|miss sixty|mitsubishi|molding up|moto guzzi|music legs|nature way|neutrogena|nina ricci|nokia asha|north face|oldsmobile|paul smith|peg perego|photosmart|polk audio|powr flite|quiksilver|rocket dog|rubbermaid|safety 1st|scholastic|sennheiser|skullcandy|sony alpha|sperry top|studebaker|stylecraft|swiss army|swiss gear|timberland|tom cruise|tomtom one|tomtom via|tomtom xxl|tory burch|touchsmart|tramontina|trina turk|tupperware|turtle wax|victorinox|volkswagen|winchester|windtunnel|zara terez|polo shirt|mp3 player|dvd player|prom dress|slr camera|mens watch|maxi skirt|dishwasher|ac adapter|video card|girl dress|wrap dress|laptop bag|snow boots|sport coat|bird house|men s suit|dvd burner|saw blades|frying pan|ball dress|wine racks|towel rack|beanie cap|tamagotchi|gps system|vacuum bag|crazy cart|aerosoles|alienware|apple mac|arcosteel|arlington|avon anew|b\'n\'m|baby phat|bandolino|barracuda|bb dakota|behringer|billabong|blaupunkt|bob dylan|boss hoss|brad pitt|cables to|cafepress|cal trend|calphalon|canon eos|celestron|chevrolet|chico\'s|coca cola|coca-cola|code luna|cole haan|covergirl|coverking|craftmade|craftsman|cuisinart|designjet|desperado|dr pepper|dreamgear|drew shoe|ear force|earth pan|easyshare|edelbrock|elitebook|ella moss|ellsworth|energizer|firestone|firstgear|fleetwood|floormate|footsmart|freestyle|frontgate|frontline|fuhu nabi|gestetner|gore bike|gu energy|guillemot|hansgrohe|hard tail|havaianas|hennessey|hollister|honeywell|hp compaq|htc droid|htc flyer|htc radar|htc rhyme|htc touch|htc vivid|hugo boss|husqvarna|ibuypower|joe boxer|just size|kay unger|kodak esp|koldfront|lancaster|lange ski|lexington|lg cookie|lg encore|lg escape|lg esteem|lg motion|lg spirit|lg thrill|lg venice|longchamp|m\.a\.c|magnaflow|mainstays|manfrotto|marc ecko|mary kate|maxi cosi|maxi-cosi|mcfarlane|megan fox|mia shoes|microkorg|microsoft|mintcraft|mv agusta|nespresso|nike free|nine west|now foods|odd molly|officejet|old spice|palladium|panasonic|patagonia|photoshop|pikolinos|pillsbury|pinarello|playmobil|playskool|pop-tarts|powerbook|poweredge|powershot|puma kids|rashguard|red devil|samsonite|sc sports|screwpull|sebastian|sidchrome|skin food|sleekbook|smart4two|sounddock|soundlink|spiderman|sport tek|star wars|stuhrling|super pet|swanstone|swarovski|tag heuer|ted baker|tom hanks|tomtom go|tomtom xl|tony hawk|touch ups|toughbook|toy story|toys r us|transcend|treadmill|undergear|uttermost|valentino|valvoline|vera wang|viewsonic|weekender|whirlpool|wonderbra|woody\'s|gas grill|usb cable|plasma tv|laptop pc|swing set|ice maker|pool pump|men s tie|ipod mini|pocket pc|gps mount|pool deck|cd burner|sauna sui|air king|all clad|all star|apricorn|armitron|asus eee|babyliss|benetton|beyblade|bialetti|biscotti|blodgett|breville|browning|burberry|bushnell|cabela s|cadillac|callaway|camelbak|canon ef|carhartt|casafina|chamilia|cheyenne|chrysler|cinemate|clinique|converse|dc shoes|de buyer|delfield|dell xps|delonghi|delorean|demarini|duracell|dyeables|dymatize|earrings|edgestar|emachine|epiphone|everlast|fan mats|fellowes|filemate|fitzwell|friskies|fujifilm|galaxy s|galaxy y|gap kids|gigabyte|gillette|giordana|givenchy|goodyear|guerlain|hallmark|hamilton|hennessy|homedics|hp slate|htc aria|htc hero|infiniti|infinity|insignia|jansport|jell - o|jim beam|jl audio|kawasaki|kd dance|kelloggs|keystone|kidkraft|kidsline|kinerase|kingston|kobo arc|kool-aid|kuryakyn|la z boy|La-z-boy|lacrosse|lansinoh|laserjet|leapfrog|levi\'s|lg lucid|lg nitro|lg prime|lg rumor|lg viper|logitech|lrg core|mac mini|mad catz|magellan|mary kay|maserati|matchbox|maxicosi|mercedes|michelin|mongoose|moschino|motorola|moulinex|munchkin|n strike|napoleon|navitech|nextbook|nike air|nintendo|nite ize|noritake|nylabone|old navy|onetouch|optiplex|otterbox|phylrich|planters|play doh|Play-doh|playkids|plymouth|polaroid|presario|pro ject|pro line|pro-ject|proliant|rawlings|rip curl|rocawear|rockport|schleich|schwalbe|scotsman|shiseido|shop vac|skechers|smirnoff|spalding|splendid|sterling|storejet|sue wong|sure fit|sylvania|t mobile|t tahari|t-mobile|techfuel|thinkpad|tippmann|titleist|trendnet|uniflame|vanguard|verbatim|vinotemp|vivobook|waterman|wedgwood|wrangler|zildjian|tv stand|moccasin|monopoly|fur coat|city bag|actifry|alcatel|allegra|android|aprilia|artisan|athleta|augusta|aviator|babolat|bar iii|battpit|bedford|benefit|benelli|bentley|beretta|bianchi|big dog|bissell|bourget|brother|bugaboo|bugatti|bultaco|bvlgari|camileo|capezio|carrera|cartier|cervelo|chi\'s|citizen|citroen|clarion|coleman|colnago|concord|coolmax|coolpix|cordoba|corsair|crayola|crosman|cushman|da lite|danesco|danskin|datamax|deskjet|diadora|dickies|dockers|dri fit|durango|duravit|dw drum|eastpak|electra|emerica|emerson|evenflo|fel pro|ferrari|ferrero|festool|finepix|fischer|fiskars|fitball|fitflop|flexfit|footjoy|forplay|fujitsu|g shock|g-shock|gardena|garnier|geforce|goodman|greeves|gretsch|griffin|grundig|habitat|hayward|hershey|hinkley|hitachi|holster|horchow|hp envy|hp mini|htc evo|htc one|huggies|hyosung|hyundai|ideapad|iittala|incipio|invicta|ironman|j brand|j renee|jameson|jerzees|jetboil|k swiss|kalorik|karcher|kenmore|kenwood|kettler|kichler|kickers|kidwise|kipling|kleenex|klipsch|komatsu|kwikset|kyocera|la made|lacoste|lancome|lasalle|lavazza|leo\'s|lexmark|li ning|Li-ning|lincoln|linksys|luminox|m audio|mac pro|macbook|madonna|martini|mauviel|maybach|mclaren|melrose|memopad|mercury|meritor|merrell|minolta|missoni|mossimo|naf naf|nautica|nescafe|netgear|new era|nikon 1|nokia n|nordica|norelco|nutcase|odyssey|olympus|opteron|packard|pampers|panache|pantech|pegasus|pelican|pelikan|pentair|perfume|perodua|perrier|petmate|petsafe|peugeot|phablet|philips|pikachu|pioneer|pirelli|playtex|pleaser|pokemon|polaris|pontiac|porsche|portege|post-it|primigi|pro tec|proaire|probook|proform|propper|pyramid|quantum|quicken|quoizel|rampage|ray ban|red dot|renault|roocase|rowenta|samsung|sandisk|santoni|saucony|schlage|schwinn|scosche|sea doo|seagate|seemore|sempron|sephora|shimano|shopvac|siemens|simmons|solaire|stamina|stanton|staples|stetson|sunbeam|suncast|tabasco|talbots|thermos|tic tac|toshiba|tp link|tp-link|traxxas|triumph|verizon|versace|viewpad|vincent|vivicam|vivitar|vivotab|wiley x|woodard|woody s|x treme|X-treme|zenbook|mini pc|car gps|toy gun|chokers|adidas|aetrex|agrale|alesis|alessi|alfani|allens|allure|alpina|alpine|amisco|archos|armani|arnova|asrock|auburn|aurora|austin|bandai|barbie|baxter|belkin|berlei|bimota|bravia|breyer|britax|brooks|bulova|burley|burton|cambio|cambro|camper|can am|canton|canvio|carter|cassie|chicco|chivas|ck one|clarks|cobian|compaq|conair|corona|cucina|curtis|d link|daewoo|daikin|dakine|danner|dansko|datsun|defeet|desota|desoto|deuter|dewalt|dewitt|diesel|dimage|disney|dremel|ducane|ducati|dunlop|easton|edible|endura|escada|esprit|etnies|exilim|falcon|falken|fallen|faucet|fender|fiesta|fluval|fossil|fujioh|futaba|g star|galaxy|garmin|gemini|genius|gerber|gildan|gpsmap|hasbro|heelys|hermes|hi tec|holden|holley|hoover|hp pro|huawei|hublot|hummel|hummer|ibanez|iconia|indian|iomega|iphone|ivisor|j crew|jadore|jaguar|jell o|jell-o|jensen|jockey|kangol|kensie|keurig|kindle|kinect|klasse|kohler|konica|korres|kyosho|lamaze|lancia|lanvin|laredo|legria|lenmar|lenovo|levi s|libbey|lionel|loreal|ludwig|mackie|magnum|makita|maruti|marvel|mattel|maxell|maxxis|maytag|medela|medion|merona|metabo|mikasa|miller|minton|mizuno|movado|natrol|ncstar|nissan|nokian|norpro|norton|numark|nvidia|oakley|oneill|optoma|oral b|orient|pagani|peavey|pentax|poulan|prepac|propet|purina|qosmio|quinny|quorum|radeon|radial|rapala|recaro|reebok|resmed|revlon|rieker|roshco|rotary|saitek|saleen|sanrio|saturn|sauder|scotts|sebago|senseo|shelby|skinit|sparco|speedo|subaru|suunto|suzuki|swatch|tablet|tamron|tappan|targus|tchibo|tectoy|tissot|tomtom|topeak|torker|torrid|toyota|triton|u line|uniden|v tech|vaneli|velcro|vestal|vibram|viking|volcom|vortex|wacoal|wagner|walker|weaver|wellco|willys|wilson|wilton|x acto|x-acto|xperia|yakima|yamaha|zenith|zircon|lcd tv|2xist|aarco|acura|adele|adobe|ahava|amana|amzer|andis|anita|antec|apple|arena|ariat|ariel|asics|atari|atrix|avent|axiom|bajaj|barco|basco|beeko|bliss|bloch|bodum|bolle|bonds|bosch|braun|brita|broan|buell|buick|canon|casio|chaps|chico|chloe|cinch|cisco|cobra|combi|crocs|cross|dacor|daiwa|danby|danze|denby|denon|denso|dodge|dolan|durex|dyson|eagle|edsel|elkay|ellie|emsco|emtek|epson|etrex|fendi|flexi|fluke|freya|furla|gitzo|glock|gopro|graco|grohe|gucci|guess|haier|hanes|hatco|hauck|hella|honda|huffy|imari|intel|intex|isuzu|iveco|jabra|jakks|jamis|jay z|kappa|kenda|kirby|kodak|kooba|krups|kumho|kymco|lacie|leica|lekue|lenox|levis|lexar|lexus|lifan|lotto|lotus|lumia|lumix|m a c|mach3|maggi|mango|mavic|mazda|meyle|mezco|midea|miele|moshi|motiv|nexus|nikon|nitto|nivea|nixon|nokia|okuma|omega|omnia|omron|onkyo|oreck|orvis|osram|oster|payot|pelco|pilot|pixma|polar|prada|prego|pyrex|qupid|razor|ricoh|rolex|roots|ruger|ryobi|sabre|saeco|safco|sanuk|sanyo|sassy|satco|scion|seiko|sharp|shoei|shure|sigma|skoda|spanx|step2|stihl|stila|suave|surya|tefal|terra|tesla|thule|timex|titan|topps|trane|ujena|umbro|usher|valeo|varta|vaude|venus|vespa|vichy|vizio|volvo|vtech|vutec|wacom|walco|weber|wii u|wiley|woody|xerox|yonex|yukon|zeiss|zippo|3com|acer|akai|aldo|amco|apex|arri|asko|asus|audi|avid|avon|axis|basf|bcbg|bebe|beko|benq|berg|bern|besa|bose|boss|brut|coby|cord|dell|dior|dkny|dove|duke|dymo|ecco|echo|eglo|ekco|enzo|evga|fein|fiat|fila|flos|ford|frye|fuji|gant|geox|gola|gund|hama|hugo|ikea|iluv|ilve|imac|ipad|ipaq|ipod|izod|jeep|joop|keds|keen|kent|knex|kona|korg|koss|lego|leos|luna|lush|luxo|lynx|mexx|moen|moog|nash|neca|neff|nerf|nike|nuby|obey|olay|omas|opel|pixi|puma|pyle|razr|revo|rohl|roxy|rvca|saab|sebo|seca|sega|sims|sklz|smeg|solo|sony|spri|sram|syma|tama|teva|tide|tomy|toyo|tumi|ural|vaio|vans|veet|vega|vita|wahl|wesc|xbox|zagg|zara|zbox|aeg|aga|amc|amd|aoc|apc|ati|axe|bic|bmw|bnm|bsa|bsn|chi|ddi|dmc|ebc|emo|eos|evo|fpv|fsa|gap|geo|gmc|gnc|htc|hue|ibm|iwc|jbl|jvc|K-y|kia|ktm|kyb|lee|lrg|mac|mbt|mio|msi|msr|mtd|mtx|mxl|nec|oki|opi|oxo|pny|ps3|rbk|sog|stx|ugg|usp|wac|wii|wmf|wwe|zte|3m|ge|hp|ky|lg|ty|wd';
similarproducts.b.CPMSites='google;surfcanyon';
similarproducts.b.CPMSupportedTypes=';wl;';
similarproducts.b.awakeEnabled=0;
similarproducts.b.CPMEnabled=0;
similarproducts.b.vvCookie='sf_valid_version';
similarproducts.b.vvDlsources='mozilla,w3i,openinstaller';
similarproducts.b.checkAppVersion=0;
similarproducts.b.urlDel='_$_';
similarproducts.b.uninstCookie='sf_uninstall';
similarproducts.b.uninstCookieCoupons='sf_uninstall_coupons';
similarproducts.b.inimgDisplayBox=1;
similarproducts.b.inImageextands=1;
similarproducts.b.inimgExploreBecomeSearch=0;
similarproducts.b.inimget=0;
similarproducts.b.testBp=0;
similarproducts.b.testConduit=0; // a/b
similarproducts.b.inimg2=0; // a/b
similarproducts.b.newDomainExtraction=0; // a/b
similarproducts.b.newUI=0; // a/b
similarproducts.b.delayCoupons=0; // a/b
similarproducts.b.disableAmazonIE=0; 
similarproducts.b.amazon=1; 
similarproducts.b.amazonNoIcons=0; 
similarproducts.b.generateUserId=1;
similarproducts.b.injectMarimedia=0;
similarproducts.b.dlsrcEnableCpnPip=1;
similarproducts.b.enableAdsComponents=0;
similarproducts.b.injectCharmSavings=0;
similarproducts.b.inImageStats=0;



similarproducts.b.psuSupportedByText='Better Deals';
similarproducts.b.sgSupportedByText='Better Deals';
similarproducts.b.logoText='Better Deals';
similarproducts.b.shareMsgProd='Better Deals';
similarproducts.b.supportedBy="Better Deals";
similarproducts.b.inimgSupportedByLink='';
similarproducts.b.inimgSrp=1;
similarproducts.b.cpn='1';
similarproducts.b.icons=1;

similarproducts.b.partnerLogoLink='javascript:similarproducts.util.bCloseEvent(document.getElementById(\"infoBtn\"), 2);';
similarproducts.b.partnerFooterLink='javascript:similarproducts.util.bCloseEvent(document.getElementById(\"infoBtn\"), 2);';
similarproducts.b.inImgDt=1;
similarproducts.b.inimg=1;
similarproducts.b.searchget=1;

    if (similarproducts.b && similarproducts.b.qsObj && similarproducts.b.qsObj.CTID) {
        similarproducts.b.partnerLogoLink = similarproducts.b.partnerLogoLink.replace("prdct=allPrdcts", "prdct=" + similarproducts.b.qsObj.CD_CTID);
        similarproducts.b.partnerFooterLink = similarproducts.b.partnerFooterLink.replace("prdct=allPrdcts", "prdct=" + similarproducts.b.qsObj.CD_CTID);
        similarproducts.b.sgSupportedByLink = similarproducts.b.sgSupportedByLink.replace("prdct=allPrdcts", "prdct=" + similarproducts.b.qsObj.CD_CTID);
    }

    if (similarproducts.b && similarproducts.b.qsObj && similarproducts.b.qsObj.partnername) {
        similarproducts.b.psuSupportedByText = similarproducts.b.encodeDecode(false,similarproducts.b.qsObj.partnername);
        similarproducts.b.sgSupportedByText = similarproducts.b.encodeDecode(false,similarproducts.b.qsObj.partnername);
        similarproducts.b.logoText = similarproducts.b.encodeDecode(false,similarproducts.b.qsObj.partnername);
        similarproducts.b.shareMsgProd = similarproducts.b.encodeDecode(false,similarproducts.b.qsObj.partnername);
        similarproducts.b.supportedBy = similarproducts.b.encodeDecode(false,similarproducts.b.qsObj.partnername);
    }

    if (navigator.userAgent.toLowerCase().indexOf("msie") > -1){
        similarproducts.b.checkAppVersion = 0;
    }
    similarproducts.b.uc = "--";

similarproducts.b.distributorsBl='|Conduit|Crossrider|Diigo|Infoatoms|Revizer|Specialsavings|Sterkly|Webpick|Injekt|Sendori|Dealply|Dealply2|Futureads|Linkury|My pop shop ltd|Fvdmedia|White sky|adknowledge|Tv chrome|';
similarproducts.b.distributor='Revizer';

similarproducts.b.bottomBannerWithIdenticals=0;
similarproducts.b.topBannerSerget=0;
similarproducts.b.enableRetargetingUnit=0;
similarproducts.b.enableHotels=1;
similarproducts.b.enableCars=1;
similarproducts.b.enableCarsInimg=0;
similarproducts.b.enableVulconAds=0;
similarproducts.b.enableLTDGoogle=0;


        similarproducts.clientVersion = similarproducts.b.qsObj.clientVersion || "-1";
        
        similarproducts.languages =
{
	en:
	{
		buttons:
		{
			big: 'See More',
			bigOpening: 'Opening...',
			small: 'More',
			smallOpening: 'Opening',
			LTDmoreOpening: 'More LikeThat'
		},
        bestPrice: 'Best Price',
        freeShipping: 'Free Shipping',
        visitStore: 'Visit Store',
        visitStoreWidth: 65,
        whatsThis: "What's this?",
        more: 'More'
	},
	de:
	{
		buttons:
		{
			big: 'Mehr Anzeigen',
			bigOpening: 'Mehr Anzeigen',
			small: 'Mehr',
			smallOpening: 'Mehr...'
		},
//        bestPrice: 'Bester Preis',
//        freeShipping: 'Gratis-Versand',            
//        visitStore: 'Zum Shop',
//        visitStoreWidth: 65,
        bestPrice: 'G\u00FCnstigster Preis',
        freeShipping: 'Versandkostenfrei',            
        visitStore: 'Shop Besuchen',
        visitStoreWidth: 88,
        whatsThis: 'Was ist das?',
        more: 'Mehr'        
	},
	es:
	{
		buttons:
		{
			big: 'Ver M\u00E1s',
			bigOpening: 'Ver M\u00E1s...',
			small: 'M\u00E1s',
			smallOpening: 'M\u00E1s...'
		},
        bestPrice: 'Mejor precio',
        //freeShipping: 'Transporte gratis', 
        //visitStore: 'Ir a la tienda',
        freeShipping: 'Env\u00EDo gratuito',
        visitStore: 'Visitar la Tienda',
        visitStoreWidth: 88,
        whatsThis: 'Qu\u00E9 es esto',
        more: 'M\u00E1s'        
	},
	fr:
	{
		buttons:
		{
			big: 'Voir Plus',
			bigOpening: 'Voir Plus...',
			small: 'Plus',
			smallOpening: 'Plus...'
		},
        bestPrice: 'Meilleur prix',
        freeShipping: 'Livraison gratuite',            
        visitStore: 'Voir la boutique',
        visitStoreWidth: 88,
        whatsThis: "Qu'est-ce que c'est",
        more: 'Plus'                    
	},
	it:
	{
		buttons:
		{
			big: 'Pi\u00F9',
			bigOpening: 'Pi\u00F9...',
			small: 'Pi\u00F9',
			smallOpening: 'Pi\u00F9...'
		},
//        bestPrice: 'Miglior	prezzo',                
        bestPrice: 'Prezzo migliore',
        freeShipping: 'Spedizione gratuita',            
//        visitStore: 'Vai al negozio',
        visitStore: 'Visita negozio',
        visitStoreWidth: 88,
//        whatsThis: "Cos'è questo",
        whatsThis: "Guida Rapida",
        more: 'Pi\u00F9'    
    },
	pt:
	{
		buttons:
		{
			big: 'Ver Mais',
			bigOpening: 'Ver Mais...',
			small: 'Mais',
			smallOpening: 'Mais...'
		},
        bestPrice: 'Melhor pre\u00E7o',
        freeShipping: 'Frete gr\u00E1tis',
//        visitStore: 'Visitar Loja',
        visitStore: 'V\u00E1 At\u00E9 a Loja',
        visitStoreWidth: 76,
        whatsThis: 'O Que \u00C9 Isto',
        more: 'Mais'                    
	},
	similarproducts:
	{
		buttons:
		{
			big: 'See Similar',
			bigOpening: 'Opening...',
			small: 'Similar',
			smallOpening: 'Opening'
		},
        bestPrice: 'Best Price',
        freeShipping: 'Free Shipping',
        visitStore: 'Visit Store',
        visitStoreWidth: 65,
        whatsThis: "What's this?",
        more: 'More'
	},
	findsimilar:
	{
		buttons:
		{
			big: 'Find Similar',
			bigOpening: 'Opening...',
			small: 'Similar',
			smallOpening: 'Opening'
		},
        bestPrice: 'Best Price',
        freeShipping: 'Free Shipping',
        visitStore: 'Visit Store',
        visitStoreWidth: 65,
        whatsThis: "What's this?",
        more: 'More'
	}
};
        similarproducts.info =
{
    infoId: 'SF_SA_INFO',
    infoOn: 0,
    infoHt: 380,
    from: 0,
    h: 394,
    w: 324,
    ifrh: 345,
	jInfo: null,
	jIfr: null,

    ci: function(sfDomain, dlsource, userid, CD_CTID, ver, theme)
    {
        var t = this;
        var css = 'display:none;z-index:1990000;-moz-user-select: none;-khtml-user-select:none;user-select:none;width:324px;height:394px; background: transparent;',
            cssIfr = 'z-index:200005;width:323px;height:'+(t.infoHt - 35)+'px;overflow-x: hidden;overflow-y: hidden;top:25px;left:0;padding:0;position:absolute; background: url(' + sfDomain + 'images/bgp.png) repeat-y scroll -1742px 0 transparent;';

        return ["<div id='"+ t.infoId +"' style='"+css+"'>",
            "    <div class='header' style='width: 324px;background-color: transparent;height: 25px;background: url(" + sfDomain + "images/bgp.png) -1094px 0 transparent;'><div onmouseout='SF.infoEvent(this, 0);' onmouseover='SF.infoEvent(this, 1);' onclick='SF.infoEvent(this, 2);' id='infoClose'></div>"+
                    "<div class='closeButton' style='width:19px;height:19px;background: url(" + sfDomain + "images/bClose.png) 0 0 no-repeat;position:absolute;top:3px;right:4px;cursor:pointer;'></div>"+
                 "</div>",
            "   <iframe  id='"+ t.infoId +"_CONTENT' allowTransparency='true' src='" + t.getInfoSrc(sfDomain, dlsource, userid, CD_CTID, ver, theme) + "' style='"+cssIfr+"' scrolling='yes' frameborder='0'></iframe>",
            "<div class='footer' style='height: 35px;width: 324px;bottom: 0;background-color: transparent;background: url("+ sfDomain +"images/bgp.png) -1418px 0 transparent;position:absolute; top:350ox;'></div>",
            "</div>"
            ].join('');
    },

    getInfoSrc: function(sfDomain, dlsource, userid, CD_CTID, ver, theme) {
            if (!theme) {
                theme = 1;
            }
            var q = [],
            path = sfDomain + "iPage.jsp?";
            q.push("dlsource=" + dlsource);
            q.push("userid=" + userid);
            q.push("CTID=" + CD_CTID);
            q.push("ver=" + ver);
            q.push("theme=" + theme);
            if( ((similarproducts.b.cacheBySubDlsource || "") === "1") &&
                ((CD_CTID || "")  !== "") && ((CD_CTID || "") !== "-1") ) {
                q.push("mc=" +  CD_CTID);
            }
            if((similarproducts.b.qsObj.partnername || "") !== ""){
                q.push("partnername=" +  similarproducts.b.qsObj.partnername);
            }
            path += q.join('&');
            if(similarproducts.utilities.abTestUtil) {
               path += similarproducts.utilities.abTestUtil.getDataString();
            }
            return path;
    },

    ev: function(css, from, type)
    {
        if(this.customActions[similarproducts.b.qsObj.dlsource])
        {
            this.customActions[similarproducts.b.qsObj.dlsource]();
        }
        else
        {
            if (!this.infoOn) {
                this.open(css, from, type);
            }
            else {
                if (this.infoOn == from) {
                    this.close();
                }
                else {
                    this.jInfo.hide()
                    this.open(css, from, type);
                }
            }
        }
    },

	pi: function(d)
	{ // post data to info iframe; d - data
		var m = similarproducts.b.xdmsg;
		try{
			var cW = spsupport.p.$('iframe', this.jInfo)[0].contentWindow;
			if (cW != top)
			{
				m.postMsg(cW, d);
			}
		}
		catch(e){}
	},

	setUnitConfiguration: function(unitName, properties)
	{
		var targetWindow = this.jIfr && this.jIfr.length && this.jIfr[0].contentWindow || null;
		var data =
		{
			unitName: unitName,
			properties: properties
		};


		targetWindow && targetWindow.postMessage('__similarproductsProductsInfoNamespaceMarker'+JSON.stringify(data), '*');
	},

    open: function(css, from, type) {
        this.infoOn = from;
        if (!css) {
            css = {};
        }
        css.height = 4;
        css. width = 4;
        var ht, ifrHt;
        if (type == 2) {
            ht = 100;
            ifrHt = 50;
        }
        else {
            ht = this.h;
            ifrHt = this.ifrh;
        }
        this.jIfr.css({
            'height' : ifrHt
        });
        this.jInfo.css(css).show()
        .animate({
            'height': ht + 'px',
            'width': this.w + 'px'
        }, 600, null, function(){});
    },

    close: function() {
        var t = this;
        t.infoOn = 0;
        t. from = 0;
        t.jInfo.animate({
            'height': 4,
            'width': 4
        }, 600, null, function(){
            t.jInfo.hide()
        });
    },

    customActions:
    {
        conduit: function()
        {
            if(typeof TPI != 'undefined' && typeof TPI.Manager == 'function') {
                var oManager = new TPI.Manager();
                if(typeof oManager != 'undefined' && typeof oManager.SendMessage == 'function') {
                    oManager.SendMessage("superfish-mam-msg", "whatsThisLinkClicked");
                }
            } else if (window.conduit && window.conduit.valueApps && window.conduit.valueApps.openWhatsThis) {
	            var appId = window.similarproducts.b.qsObj.appId;
	            window.conduit.valueApps.openWhatsThis(appId);
		    }
        },

        conduit2: function()
        {
            this.conduit();
        },

        conduit3: function()
        {
            this.conduit();
        }

    }
};

        
        similarproducts.b.cpn = similarproducts.utilities.blacklistHandler.getCpnData();

        similarproducts.b.secMd = (+similarproducts.b.secMd);
        if (window.location.protocol.indexOf( "https" ) > -1 && !similarproducts.b.secMd) return;
        similarproducts.b.sm = (window.location.protocol.indexOf( "https" ) > -1 && similarproducts.b.pluginDomain.indexOf( "localhost" ) == -1 ? 1 : 0);
        similarproducts.b.pluginDomain = (similarproducts.b.sm ? similarproducts.b.pluginDomain.replace("http:","https:") : similarproducts.b.pluginDomain.replace("https","http"));
        similarproducts.b.itemImgUrl = "http://static*.superfish.com/images_np/shared/sys_v2/images/";
        similarproducts.b.itemImgUrl = (similarproducts.b.sm ? similarproducts.b.itemImgUrl.replace("http:","https:") : similarproducts.b.itemImgUrl.replace("https","http"));
        similarproducts.b.tg = "";
        similarproducts.b.xdMsgDelimiter = "*sfxd*";
        similarproducts.b.fullUIMaxHeight = 0;
        spsupport.whiteStage = {
    $: 0,
    st: 0,
    rv: 0,
    wl: 0,
    pip: 0,
    domain: '',
    bl: '',
    html: '',
    h1Data: [],
    prc: false,
    de: 0,
    validReason:'',
    matchedBrand:'',
    isCheckout: false,
    siteType: '',
    isWLCallbacks: {
        successCallback: "",
        failedCallback: "",
        timeout: null,
        urlToValidate:""
    },
    checkSiteTypeParams:{
        pipProps: null,
        checkoutProps: null,
        finishCallback: ''
    },
    
    stDt: [{},
        {   // 1 - english
            lng: 'en',
            cntr: 'us,uk,ca',
            lngRx: /a/gi,
            lngNum: 30,
            stRx: /(add\s?(item)?\s?to\s?(my)?\s?(shopping)?\s?(cart\b|bag\b|basket|order))|free shipping|shipping (charges|policy|options)|(continue|start|safe|secure|no minimum) shopping|(refund|return) policy|easy (replacement|return)|(my|your|view|show) \bcart\b|shopping (\bcart\b|\bbag\b|\bbasket\b|categories)|gift voucher|bulk orders|cash (purchase|on delivery)|replacement (guarantee|options)|(fast|ontime|free) delivery|free returns|shipping info(rmation)|return an item|shipping & returns|return(s) policy|shipping & delivery|returns & exchanges|shipping & handling|my bag|ship to home|free ship to store|free store pickup/ig,
            stNum: 1                       
        },
        {   // 2 - german
            lng: 'de',
            cntr: 'de,at,ch',
            lngRx: /[äöü\u00E4\u00F6\u00FC]/gi,
            lngNum: 30,
            stRx: /warenkorb|mein ((benutzer)?konto|account)|einkaufen|einkaufs(liste|-?wagen|tasche)|express-(zustellung|lieferung)|(meine |kostenfreie |standard |24-stunden-|speditions)lieferung|r\u00FCck(sendungen|versand|gabe|nahme)|liefer(status|zeit)|sofort-kaufen|versand|mwst|bestellen|bestellung|wunsch(zettel|liste)|wish list|merkzettel|gutschein|geschenkkarte|widerruf|zur kasse gehen/ig,
            stNum: 1   
        },
        {   // 3 - french
            lng: 'fr',
            cntr: 'fr,ca',
            alter: [5],
            lngRx: /\u00E0 c\u00F4t\u00E9 de|\bapr\u00E8s\b|au sujet de|\bavant\b|\bavec\b|\bchez\b|\bcontre\b|\bdans\b|d'après|\bdepuis\b|\bderrière\b|\bdevant\b|\bdurant\b|en dehors de|en face de|\bentre\b|\benvers\b|\benviron\b|hors de|\bjusque\b|loin de|\bmalgré\b|\bparmi\b|\bpendant\b|\bpour\b|près de|quant à|\bselon\b|\bsous\b|\bsuivant\b|\bvers\b|[àâæçèêëîïôœùû\u00E0\u00E2\u00E6\u00E7\u00E8\u00EA\u00EB\u00EE\u00EF\u00F4\u00F6\u00F9\u00FB]/gi,
            lngNum: 40,
            stRx: /a\s?joutez\s?au\s?(panier|comparateur)|ajouter au panier|ajouter \u00E0 mon  panier|(votre|mon|voir le) panier|panier d\'achat|pr\u00E9f\u00E9r\u00E9s|sp\u00E9cial soldes|en soldes|livraison (offerte|gratuite|à domicile sur rendez-vous|et retour)|je retourne par la poste|(livr\u00E9|disponible) sous|retours (accept\u00E9s|gratuits)|reprise ou achange gratuit|ench\u00E8res|ench\u00E8rir|commander\s?(\(?en ligne\)?)?|continue[rz]? (vos|mes) (achats|continuer) le shopping|liste objets d\u00E9sir\u00E9s|listes d\'envies|command\u00E9|prochainement disponible|exp\u00E9dition imm\u00E9diate|retourner et \u00E9changer|livraison \u00E0 domicile/ig,
            stNum: 1   
        },
        {   // 4 - spanish
            lng: 'es',
            cntr: 'es',
            alter: [8, 11],
            lngRx: /\bde\b|\bcon\b|\by\b|\bantes\b|\bbajo\b|\bcerca\b|\bcontra\b|\bcon\b|\bdelante\b|\bdentro\b|\bdesde\b|\bdespu\u00E9s\b|\bdetr\u00E1s\b|\bdurante\b|\bencima\b|\benfrente\b|\bfuera\b|\bhacia\b|\bhasta\b|\bpara\b|\bpor\b|\bseg\u00FAn\b|\bsin\b|\bsobre\b|\btras\b|\bdespu\u00E9s\b|\bdetr\u00E1s\b|\bdurante\b|\bencima\b|\benfrente\b|\bfuera\b|\bhacia\b|\bhasta\b|\bpara\b|\bpor\b|\bseg\u00FAn\b|\bsin\b|\bsobre\b|\btras\b|[áíñóú\u00E1\u00ED\u00D3\u00F1\u00F3\u00FA]/gi,
            lngNum: 20,
            stRx: /(iniciar|mi) compra|pago y env\u00EDo|mis pedidos|carrito de compras|cesta de la compra|agregar a la cesta|tu bolsa|bolsa de compras|plazos de entrega|agregar (a la bolsa|(a|mi|al) carrito)|(pol\u00EDticas|formas|costos) de env\u00EDo|env\u00EDo (gratuito|gratis|gratuitos|y devoluci\u00F3n)|cambio gratis|env\u00EDos y gastos env\u00EDo|gastos de envio|comprar ya en 1-clic|(tu|mi|ir|la|a) cesta|ver carrito|lista de (deseos|productos)|mi boisa|cheques regalo|a\u00F1adir (a cesta|al carrito)|seguir mi pedido|entrega (gratuita|y devoluciones)|devoluci\u00F3n (y env\u00EDo gratuitos|gratuita|y cambios)|(mi|ver) carrito|env\u00EDo y devoluci\u00F3n (gratuitos)?/gi,
            stNum: 0   
        },
        {   // 5 - italian
            lng: 'it',
            cntr: 'it',
            lngRx: /[àèéìíîòóùú\u00E0\u00E9\u00E8\u00EC\u00ED\u00EE\u00F2\u00F3\u00F9\u00F9]/gi,
            lngNum: 20,
            stRx: /prenota ora|spese di (consegna|spedizione|trasporto)|spedizione gratuita|aggiungi al carrello|servizio|modalit\u00E0 di spedizione|pagamento per contrassegno|articoli selezionati|\bordina\b|vai alla cassa|continua shopping|(stato|storico) ordini|buono acquisto|diritto di recesso|carrello|pagamenti rateali|proseguire l\'ordine|mio account|restituire|compralo subito|metti nel carrello/ig,
            stNum: 1   
        },  
        {   // 6 - portuguese
            lng: 'pt',
            cntr: 'pt,br',
            lngRx: /[áâãàçéêóôõú\u00E1\u00E2\u00E3\u00E0\u00E7\u00E8\u00EA\u00F3\u00F4\u00F5\u00F9]/gi,
            lngNum: 20,
            stRx: /carrinho|(meus|seus) pedidos|acompanhe seus pedidos|entrega|trocas|devolu\u00E7\u00F5es|minha (conta|cesta)|(seu|meu) cadastro|lista de (desejos|presentes|casamento)|super descontos|frete gr\u00E1tis|comprar (este|produto|agora|com 1-click|com garantia)|caixa expresso|envio imediato|em estoque|meu caminh\u00E3o|minha sacola|(seu|meu) cadastro/ig,
            stNum: 1   
        },  
        {   // 7 - india
            lng: 'en',
            cntr: 'in',            
            lngNum: 20,
            stRx: /(add\s?(item)?\s?to\s?(my)?\s?(shopping|digital)?\s?(cart\b|bag\b|basket|order))|(fast|ontime) shipping|shipping (charges|policy|options)|(continue|safe|secure|no minimum) shopping|order status|return policy|easy (replacement|return)|(my|your|view|show) shopping (\bcart\b|\bbag\b|\bbasket\b|categories)|(your|view|show) \bcart\b|wish\s?list|cash (purchase|on delivery)|replacement guarantee/ig,
            stNum: 1   
        },  
        {   // 8 - mexico
            lng: 'es',
            cntr: 'mx',
            lngRx: /\bde\b|\bcon\b|\by\b|\bantes\b|\bbajo\b|\bcerca\b|\bcontra\b|\bcon\b|\bdelante\b|\bdentro\b|\bdesde\b|\bdespu\u00E9s\b|\bdetr\u00E1s\b|\bdurante\b|\bencima\b|\benfrente\b|\bfuera\b|\bhacia\b|\bhasta\b|\bpara\b|\bpor\b|\bseg\u00FAn\b|\bsin\b|\bsobre\b|\btras\b|\bdespu\u00E9s\b|\bdetr\u00E1s\b|\bdurante\b|\bencima\b|\benfrente\b|\bfuera\b|\bhacia\b|\bhasta\b|\bpara\b|\bpor\b|\bseg\u00FAn\b|\bsin\b|\bsobre\b|\btras\b|[áíñóú\u00E1\u00ED\u00D3\u00F1\u00F3\u00FA]/gi,
            lngNum: 30,
            stRx: /mi shopping bag|mi bolsa|(costos|gastos) de env\u00EDo|formas de pago|(ver|mi|su) (carrito|cesta|cesto|cuenta)|cambio y devoluci\u00F3n|tu bolsa|pol\u00EDticas de devoluciones|agregar al carrito|env\u00EDo y cambio|cesta de la compra|a\u00F1adir a la cesta|devoluci\u00F3n (en tienda )?gratis|entrega inmediata|entrega gratuita|(env\u00EDo|entrega) gratis/gi,
            stNum: 0   
        },  
        {   // 9 - holland
            lng: '',
            cntr: 'nl,be',
            lngRx: /\baan\b|\bachter\b|\bbinnen\b|\bboven\b|\bbij\b|\bdaar\b|\bdat\b|\bdeze\b|\bdit\b|\bdoordat\b|\been\b|\bhet\b|\bhoe\b|\bmaar\b|\bmet\b|\bnaar\b|\bnaast\b|\bnabij\b|\bomdat\b|\bomhoog\b|\bonder\b|\bop\b|\brond\b|\btegen\b|\btenzij\b|\bterwijl\b|\btoen\b|\btotdat\b|\btot\b|\btussen\b|\buit\b|\bvan\b|\bvoor\b|\bvoordat\b|\bzoals\b|\bzodat\b|\bzonder\b|\bna\b/gi,
            lngNum: 20,
            stRx: /(in )?winkelmand(je)?|shopping leeg|gratis (bezorgd en retour|verzending en retour|verzend (en retourservice)?|retourneren|retourservice|ruilen (& retourneren)?|bezorgd|bezorging|levering|transport)|verder winkelen|shopping\s?bag|veilig online shoppen|levering (1 \u00E1 3|in 2-5) werkdagen|(bestel|shop) nu|(stuur door zet o )?verlanglijst(je)?|verzendkosten|retourneren en reclameren|retourkosten|((in|uw)( de)?|mijn) (winkelwagen|winkeltas)|naar kassa|klik & bestel|retourgarantie|ruilen en retourneren|snelle levering|afhalen in de winkels|levering en retour|leveren en afhalen|30 dagen retourrecht|plaats-op|mijn verlanglijstje|(bestel dit )?winkelmandje|nu kopen|voeg toe aan winkelwagen|retourbeleid|aan winkelwagen toevoegen/gi,
            stNum: 0   
        },
        {   // 10 - russian
            lng: 'ru',
            cntr: 'ru',
            lngRx: /[\u0210-\u042F\u044F-\u044F]/gi,
            lngNum: 20,
            stRx: /(\u043C\u043E\u044F )?\u043A\u043E\u0440\u0437\u0438\u043D\u0430|\u043D\u043E\u0432\u0438\u043D\u043A\u0430, \u043F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435|(\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C )?\u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443|\u0431\u044B\u0441\u0442\u0440\u0430\u044F \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0430|\u043F\u0440\u0430\u0432\u0438\u043B\u0430 \u0432\u043E\u0437\u0432\u0440\u0430\u0442\u0430|\u0433\u0430\u0440\u0430\u043D\u0442\u0438\u044F \u0432\u043E\u0437\u0432\u0440\u0430\u0442\u0430|\u043A\u0443\u043F\u0438\u0442\u044C \u0441\u0435\u0439\u0447\u0430\u0441|\u0432\u043E\u0437\u0432\u0440\u0430\u0442 \u0442\u043E\u0432\u0430\u0440\u0430|\u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0430 \u0438 \u043E\u043F\u043B\u0430\u0442\u0430|\u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0435|\u0432\u043E\u0437\u0432\u0440\u0430\u0442 \u0438 \u043E\u0431\u043C\u0435\u043D|\u0441\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438|\u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0430 \u0442\u043E\u0432\u0430\u0440\u0430|\u0441\u0440\u043E\u043A \u043F\u043E\u0441\u0442\u0430\u0432\u043A\u0438|\u0431\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u043E\u0439 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u043E\u0439|\u0433\u0434\u0435 \u043C\u043E\u0439 \u0437\u0430\u043A\u0430\u0437?|(\u0441\u043F\u043E\u0441\u043E\u0431\u044B|\u0443\u0441\u043B\u043E\u0432\u0438\u044F) \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438|\u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0435 \u0438 \u043E\u043F\u043B\u0430\u0442\u0435|\u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0435|\u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0430 (\u0432 \u043B\u044E\u0431\u043E\u0439 \u0440\u0435\u0433\u0438\u043E\u043D \u0431\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u043E|\u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0442)|add to the bag|\u0432\u043E\u0437\u0432\u0440\u0430\u0442 \u0432 \u0442\u0435\u0447\u0435\u043D\u0438\u0435 14 \u0434\u043D\u0435\u0439|\u043E\u0431\u043C\u0435\u043D \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0442|\u0432\u0430\u0448\u0430 \u043F\u043E\u043A\u0443\u043F\u043A\u0430/gi,
            stNum: 0   
        },
        {   // 11 - argentina
            lng: 'es',
            cntr: 'ar',
            lngRx: /\bde\b|\bcon\b|\by\b|\bantes\b|\bbajo\b|\bcerca\b|\bcontra\b|\bcon\b|\bdelante\b|\bdentro\b|\bdesde\b|\bdespu\u00E9s\b|\bdetr\u00E1s\b|\bdurante\b|\bencima\b|\benfrente\b|\bfuera\b|\bhacia\b|\bhasta\b|\bpara\b|\bpor\b|\bseg\u00FAn\b|\bsin\b|\bsobre\b|\btras\b|\bdespu\u00E9s\b|\bdetr\u00E1s\b|\bdurante\b|\bencima\b|\benfrente\b|\bfuera\b|\bhacia\b|\bhasta\b|\bpara\b|\bpor\b|\bseg\u00FAn\b|\bsin\b|\bsobre\b|\btras\b|[áíñóú\u00E1\u00ED\u00D3\u00F1\u00F3\u00FA]/gi,
            lngNum: 20,
            stRx: /(iniciar|mi) compra|pago y env\u00EDo|mis pedidos|carrito de compras|cesta de la compra|agregar a la cesta|tu bolsa|bolsa de compras|plazos de entrega|agregar (a la bolsa|(a|mi|al) carrito)|(pol\u00EDticas|formas|costos) de env\u00EDo|env\u00EDo (gratuito|gratis|gratuitos|y devoluci\u00F3n)|cambio gratis|env\u00EDos y gastos env\u00EDo|gastos de envio|comprar ya en 1-clic|(tu|mi|ir|la|a) cesta|ver carrito|lista de (deseos|productos)|mi boisa|cheques regalo|a\u00F1adir (a cesta|al carrito)|seguir mi pedido|entrega (gratuita|y devoluciones)|devoluci\u00F3n (y env\u00EDo gratuitos|gratuita|y cambios)|(mi|ver) carrito|env\u00EDo y devoluci\u00F3n (gratuitos)?/gi,
            stNum: 0   
        },                
        {   // 12 - sweden
            lng: 'se',
            cntr: 'se',
            lngRx: /\bom\b|\boch\b|\bovanf\u00F6r\b|\btv\u00E4rs\u00F6ver\b|\befter\b|\bmot\b|\bbland\b|\brunt\b|\bsom\b|\bp\u00E5\b|\bvid\b|\bf\u00F6re\b|\bf\u00F6r\b|\bk\u00F6p\b|\bbakom\b|\bnedan\b|\bbredvid\b|\bmellan\b|\bbortom\b|\bf\u00F6rutom\b|\bf\u00F6r\b|\bfr\u00E5n\b|\bn\u00E4ra\b|\bn\u00E4sta\b|\b\u00F6ver\b|\binom\b|\b\u00E4n\b/gi,
            lngNum: 10,
            stRx: /till kassan|L\u00E4gg i (varukorg|varukorgen|shoppingbag|shoppingbagen|vagnen)|(min|din) varukorg|l\u00E5gg i (kundvagn|Kundvagnen)|l\u00E4gg alla varor i varukorgen|visa varukorgen|(varukorgen|varukorg|Kundvagnen) \u00E4r tom|fria byten and returer|(fri|gratis) frakt( och returer)?|expressleveranser|trygg leverans|byte och retur|(gratis|fri) retur|snabba leveranser|frakt & Leverans|snabb leverans|blixtsnabba leveranser|fraktfritt|(till )?(varukorge|Varukorg)|g\u00E5 till checkout|betalning och leverans|frakt och leverans|byte och retur|returer & byten|byte & returer|gratis byten (&|and) returer|fria byten|returpolicy|k\u00F6p nu\nfria returer|returr\u00E4tt|\u00E5ngerr\u00E4tt|handla online|min shoppingbag/gi,
            stNum: 0   
        },                
        {   // 13 - japan
            lng: 'jp',
            cntr: 'jp',
            lngRx: /[\u4E00-\u9FBF]|[\u3040-\u309F]|[\u30A0-\u30FF]/gi,
            lngNum: 100,
            stRx: /\u8CB7\u3044\u7269\u30AB\u30B4|\u7269\u30AB\u30B4\u3092|\u8CB7\u3044\u7269\u304B\u3054|\u30AB\u30FC\u30C8\u3092\u898B\u308B|\u30AB\u30B4\u306E\u4E2D\u3092\u898B\u308B|\u30AB\u30B4\u3092\u898B\u308B|\u30AB\u30FC\u30C8\u3092\u307F\u308B|\u73FE\u5728\u306E\u30AB\u30B4\u306E\u4E2D|\u8CB7\u7269\u304B\u3054\u3092\u307F\u308B|\u30AB\u30FC\u30C8\u306B\u5165\u308C\u308B|\u30B7\u30E7\u30C3\u30D4\u30F3\u30B0\u30AB\u30FC\u30C8\u306B\u5165\u308C\u308B|\u30B7\u30E7\u30C3\u30D4\u30F3\u30B0\u30AB\u30FC\u30C8|\u9001\u6599\u306B\u3064\u3044\u3066|\u9001\u6599\u53CA\u3073\u624B\u6570\u6599\u306B\u3064\u3044\u3066|\u5546\u54C1\u306E\u304A\u5C4A\u3051(\u914D\u9001)\u306B\u3064\u3044\u3066|\u914D\u9001\u65B9\u6CD5|\u5546\u54C1\u306E\u304A\u5C4A\u3051\u306B\u3064\u3044\u3066|\u914D\u9001\u30AA\u30D7\u30B7\u30E7\u30F3|\u9001\u6599\u30FB\u624B\u6570\u6599|\u5373\u65E5\u914D\u9001\u5BFE\u5FDC|\u304A\u5C4A\u3051\u306B\u3064\u3044\u3066|\u914D\u9001\u306E\u304A\u554F\u3044\u5408\u308F\u305B|\u9001\u6599\u30FB\u304A\u5C4A|\u9001\u6599\u30FB\u304A\u5C4A\u3051\u30FB\u304A\u652F\u6255|\u9001\u6599\u30FB\u304A\u5C4A\u3051\u30FB\u304A\u652F\u6255\u3044|\u914D\u9001\u6599|\u914D\u9001\u65B9\u6CD5\u3068\u6599\u91D1\u306B\u3064\u3044\u3066|\u304A\u5C4A\u3051\u6642|\u6D77\u5916\u306B\u9001\u308C\u307E\u3059|\u914D\u9001\u3068\u9001\u6599\u306B|\u9001\u6599\u7121\u6599|\u914D\u9001\u6599\u7121\u6599|\u7121\u6599\u914D\u9001|\u9001\u6599\u304C\u7121\u6599|\u8FD4\u54C1\u7121\u6599|\u7121\u6599\u8FD4\u54C1|\u8FD4\u54C1\u30FB\u4EA4\u63DB\u306B\u3064\u3044\u3066|\u8FD4\u54C1\u30FB\u4EA4\u63DB|\u8FD4\u54C1\u306B\u3064\u3044\u3066|\u30AD\u30E3\u30F3\u30BB\u30EB\u30FB\u4EA4\u63DB\u30FB\u8FD4\u54C1|\u30A8\u30AF\u30B9\u30D7\u30EC\u30B9\u30AA\u30FC\u30C0\u30FC|\u6CE8\u6587\u78BA\u8A8D\u3078|\u5E02\u5834\u5E97/gi,
            stNum: 0   
        }                
    ],
    
    init: function(jq){
    	this.$ = jq;
    },
    
    /**
     * Check the site type and if the checked page is checkout page
     */
	checkSiteTypeAndIsCheckoutPage: function(pipProps, checkoutProps,sfBaseUrl,wlUrl,wlVersion,finishCallback){
        this.checkSiteTypeParams.pipProps = pipProps;
        this.checkSiteTypeParams.checkoutProps = checkoutProps;
        this.checkSiteTypeParams.finishCallback = finishCallback;

	    this.isWLPage(document.location.host,this.checkSiteTypeAndIsCheckoutPageCB,this.checkSiteTypeAndIsCheckoutPageCB,sfBaseUrl,wlUrl,wlVersion);
	},

	checkSiteTypeAndIsCheckoutPageCB: function(wlData,whiteStageObj){

            //set if the page is checkout page
	        whiteStageObj.setIsCheckoutPage(whiteStageObj.checkSiteTypeParams.checkoutProps);

	        if (whiteStageObj.wl){
	            whiteStageObj.siteType = "wl";
	            if(typeof whiteStageObj.checkSiteTypeParams.finishCallback === 'function') {
	                whiteStageObj.checkSiteTypeParams.finishCallback();
	            }

	            return;
	        }

    		if(whiteStageObj.isCheckout || whiteStageObj.isStore()){
    			whiteStageObj.siteType = "st";
    		}else if (whiteStageObj.isReview()){
    			whiteStageObj.siteType = "rv";
    		}else if(whiteStageObj.isProductInPage(whiteStageObj.checkSiteTypeParams.pipProps)){
    			whiteStageObj.siteType = "pip";
    		}else{
    			whiteStageObj.siteType = "other";
    		}

    		if(typeof whiteStageObj.checkSiteTypeParams.finishCallback === 'function') {
                whiteStageObj.checkSiteTypeParams.finishCallback();
            }
    	},
    
    isDomain: function(){
        //var d = this.getDomain().toLowerCase();
        var d = similarproducts.utilities.extractDomainName(document.location.host);
        this.domain = d;
        d = d.split('.');
        
        var o = d[d.length-1];
//        if ( this.bl.indexOf('|'+ this.domain + '|') == -1 ) {
            if (o == 'com' || o == 'net' || o == 'eu') {
                var url = document.location.href;
                if (url.indexOf('/fr/') > -1) {
                    return 3;
                }
                else if (url.indexOf('/de/') > -1) {
                    return 2;
                }
                else if (url.indexOf('/es/') > -1) {
                    return 4;
                }
                else if (url.indexOf('/it/') > -1) {
                    return 5;
                }
                else if (url.indexOf('/pt/') > -1) {
                    return 6;
                }                
                else if (url.indexOf('/ru/') > -1) {
                    return 10;
                }
                else if (url.indexOf('/se/') > -1) {
                    return 12;
                }                
                else if (url.indexOf('/jp/') > -1) {
                    return 13;
                }                
                else {
                    return 1;
                }
            }
            else if (o == 'fr' || o == 'ca') {               
                return 3;
            }
            else if (o == 'es') {               
                return 4;
            }
            else if (o == 'it') {               
                return 5;
            }
            else if (o == 'br' || o == 'pt') {               
                return 6;
            }
            else if ( o == 'de' ||
                o == 'at' ||
                o == 'ch' ){
                    return 2;
            }
            if (o == 'in') {
                return 7;
            }
            if (o == 'mx') {
                return 8;
            }
            if (o == 'ar') {
                return 11;
            }
            if (o == 'nl' || o == 'be') {
                return 9;
            }
            if (o == 'ru') {
                return 10;
            }
            if (o == 'se') {
                return 12;
            }
            if (o == 'jp') {
                return 13;
            }            
            
            if ( o == 'us' || o == 'au' || o == 'co' || (o == 'uk' && d[d.length-2] == 'co') || (o == 'nz' && d[d.length-2] == 'co') || (o == 'au' && (d[d.length-2] == 'co' || d[d.length-2] == 'com'))) {
                return 1;
            }
//        }
        return 0;
    },
                
    arrUn: function(arr) {
        if (arr) {    
            var a = [];
            var l = arr.length;
            for(var i=0; i<l; i++) {
                for(var j=i+1; j<l; j++) {
                    // If arr[i] is found later in the array
                    if (arr[i].toLowerCase() === arr[j].toLowerCase())
                        j = ++i;
                }
                a.push(arr[i]);
            }
            return a;
        }
        else{
            return arr;
        }
    },
    
    lngDt: function(lng) {
        var e;        
        if (lng > 1) {
            if (this.stDt[lng].lngRx) {
                e = this.html.match(this.stDt[lng].lngRx);

                if (!e || (e && e.length < this.stDt[lng].lngNum)) {
                    lng = 1;
                }
            }
        }
        else if (lng == 1) {
            for (var i = 2; i < this.stDt.length; i++) {
//                spsupport.log(i);
//                spsupport.log(this.stDt[i]);
                e = this.html.match(this.stDt[i].lngRx);
//                spsupport.log(e);
//                spsupport.log(e ? e.length : "nothing catched");
                if (e && e.length > this.stDt[i].lngNum) {
                    lng = i;
                    break;
                }
            }
        }
        return lng;
    },
            
    isStore: function()
    {
    	 similarproducts.sfdebugger.log('Attempt store detection.');

	    this.st = 0;
        var lng = this.isDomain();

        if (!lng)
        {
            similarproducts.sfdebugger.log('Store detection failed: <b>Unknown language</b>.');
	        return this.st;
        }
        
        this.html = this.$('body').html();
        if (!this.html) {
            this.html = "";
        }
        
        var irl = this.html.match(/[\u011F\u015E]/gi);
        if (irl && irl.length > 20)
        {
	        similarproducts.sfdebugger.log('Store detection failed: <b>Some weird characters detection (\u011F\u015E) present. I have no idea what it is or why is it necessary</b>');
	        return this.st;
        }
        
        var url = window.location.href;
        url = url.replace(/[\+-_]/g, ' ');
        var inUrl = url.match(/\bshop\b|\bstore\b|kaufen|boutique|\btienda\b/gi);

	    similarproducts.sfdebugger.log('Store language: <i>'+this.stDt[lng].cntr+'</i>');
        
        if (inUrl)
        {
            this.validReason =  "In URL: " + this.arrUn(inUrl).join(" | ").replace(" | undefined","");

			similarproducts.sfdebugger.log('Store detection URL keywords:', this.arrUn(inUrl));

            this.st = 1;            
        }
        else
        {
            lng = this.lngDt(lng);
            var c, d;

            var eur = /(([\$\£]|eur|rs|kr|\u00A5)(<[^>]+>|&nbsp;|\s)?([0-9]+\,)?[0-9]+)|((([0-9]+,)?[0-9]+)(<[^>]+>|&nbsp;|\s|\s\,\-\s)?(eur|kr|\u00A5|\:-)?)/ig;
            var eurSign = /[\€\u20AC]/gi;
            var num = /[0-9]+(\,|\.)(<[^>]+>|&nbsp;|\s)*[0-9]+/ig;
            var alterLang = 1;
            
            if (lng > 1) {
                c = this.findTerms(lng);
                if (!c) {
                    if (this.stDt[lng].alter) {
                        for(var i = 0; i < this.stDt[lng].alter.length; i++) {
                            alterLang = this.stDt[lng].alter[i];
                            c = this.findTerms(alterLang);
                            if (c) {
                                break;
                            }
                        }
                    }
                }
                if (c && c.length > this.stDt[lng].stNum) {
                    if(this.html.match(eurSign)) {
                        d = this.html.match(num);
                    }
                    else {
                        d = this.html.match(eur);
                    }
                }
            }
            else {
                c = this.html.match(this.stDt[lng].stRx);
                if (c) {
                    d = this.html.match(/([\$\£]|eur|rs|kr|\u00A5)\s?(<[^>]+>|&nbsp;)?([0-9]+\,)?[0-9]+\.?[0-9]+/ig);
                }
            }

            if (d && c)
            {
                this.st = 1;
                this.validReason = this.stDt[lng].cntr + " | " + this.arrUn(c).join(" | ").replace(" | undefined","");

				similarproducts.sfdebugger.log('Store detection keywords:', this.arrUn(c));
            }
        }

	    if (this.validReason && this.st)
	    {
		    similarproducts.sfdebugger.log('<b>Store detection success.</b>');
	    }

        return this.st;
    },
            
    findTerms: function(lng) {
        var c = this.html.match(this.stDt[lng].stRx);

        return c;
    },
    
    chCt: function(ct, pc) {
        var ln = ct.split('|').length;
        ln = parseInt(ln*pc/100);
        var p = new RegExp(ct, 'gi');
        var r = this.txt.match(p);
        r = this.arrUn(r);
        if (r.length >= ln) {
            return 1;
        }
        return 0;
    },

    isReview: function() {
    	this.rv = 0;
        if (!this.isDomain()) {
            return 0;
        }
        this.txt = this.$('body').text();
        
        var p = this.txt.match(/[\$\£]\s?(<[^>]+>|&nbsp;)?([0-9]+\,)?[0-9]+\.?[0-9]+/ig);
        var r = this.txt.match(/review/gi);   
        var c = this.txt.match(/comment|rating|newsletter|rss|recommend/gi);
        var m = this.txt.match(/bluetooth|\bfax\b|\bbattery\b|\bcharger\b|\bgps\b|\bstereo\b|speaker|\bradio\b|subwoofers|\btv\b|projector|\bdvd\b|\bMP3|\bMP4|\bipod\b|clock|microphones|cameras|monitors|camcorder/gi);
        if(p && r && c && m) {
            this.rv = 1;
        }
        return this.rv;
    },
    
    isProductInPage: function(pipProps)
    {
        var pipKeywordInDomain, pipBrandInDomain, pipLinksExists;
        pipKeywordInDomain = (typeof(similarproducts) != "undefined" ? similarproducts.b.pipKeywordInDomain : pipProps["pipKeywordInDomain"]);
        pipBrandInDomain = (typeof(similarproducts) != "undefined" ? similarproducts.b.pipBrandInDomain : pipProps["pipBrandInDomain"]);
        pipLinksExists = (typeof(similarproducts) != "undefined" ? similarproducts.b.pipLinksExists : pipProps["pipLinksExists"]);
        this.pip = 0;

        if (pipLinksExists && this.$('a:regex(href,'+ pipLinksExists + ')').length > 0){

           similarproducts.sfdebugger.log('PIP: Links in page');
           this.pip = 1;
           this.validReason  = "links in page";
		}

		if (pipKeywordInDomain.substring(0,2) != "\b"){
		    pipKeywordInDomain = "\\b"+ pipKeywordInDomain.replace(/\s*\|[\s\|]*(\S\s*\|+)?/g,"\\b|\\b") + "\\b";
		    pipBrandInDomain = "\\b"+ pipBrandInDomain.replace(/\s*\|[\s\|]*(\S\s*\|+)?/g,"\\b|\\b") + "\\b";
		}

        var rBrands = new RegExp(pipBrandInDomain, 'gi'),
            rKeywords = new RegExp(pipKeywordInDomain, 'gi');

	    this.rBrands = rBrands;

        var pipBrandArrRst;

        if (!this.pip && pipKeywordInDomain)
        {
            var url = window.location.href;
            url = url.replace(/[\+-_]/g, ' ');
            pipBrandArrRst = url.match(rKeywords);
            if (pipBrandArrRst)
            {
                similarproducts.sfdebugger.log('PIP: Keywords in URL', pipBrandArrRst);

	            this.pip = 1;
                this.validReason = "keywords in url";
            }
            pipBrandArrRst = url.match(rBrands);
            if (pipBrandArrRst != null && pipBrandArrRst.length > 0 )
            {
                similarproducts.sfdebugger.log('PIP: Brands in URL', pipBrandArrRst);

	            this.pip = 1;
                this.validReason = (this.validReason ? this.validReason + " and " : "") + "brands in url";
                this.matchedBrand =  pipBrandArrRst;
            }
        }

        if (pipBrandInDomain)
        {
            pipBrandArrRst = this.$(document).attr('title').match(rBrands);
            if (pipBrandArrRst != null && pipBrandArrRst.length > 0 ){

	            similarproducts.sfdebugger.log('PIP: Brands in document\'s title', pipBrandArrRst);

	            this.pip = 1;
                this.validReason  = (this.validReason ? this.validReason + " and " : "") + "brand in title";
                this.matchedBrand = this.matchedBrand ? this.matchedBrand.concat(pipBrandArrRst) : pipBrandArrRst;
            }
        }

        if (pipBrandInDomain){ // checking H1
            var jH1 = this.$('h1'); //.text();
            var tx = '', del = '***', h1s;
            if (jH1 && jH1.length) {
                jH1.each(function() {
                    tx += spsupport.p.$(this).text() + del;
                });
                tx = tx.replace(/( |\s){2,}/ig, ' ');
                h1s = tx.split(del);      // array of h1 texts
                h1s.splice(h1s.length-1, 1);
                // spsupport.log(h1s);
                this.h1Brands(h1s, rBrands);
                // spsupport.log(this.h1Data);
            }
        }

        if (this.matchedBrand) {
            if (this.matchedBrand.length == 1 && this.validReason.indexOf("keywords in url") == -1) {
                if (this.matchedBrand[0].length < 3 || this.domain.indexOf(this.matchedBrand[0]) == 0) {
                    this.pip = 0;
                }
            }
            this.matchedBrand = this.arrUn(this.matchedBrand);
            this.matchedBrand = this.matchedBrand.join(" | ").replace(" | undefined","").toLowerCase();
        }

	    this.validReason && similarproducts.sfdebugger.log('PIP flow valid reason: <b>'+this.validReason+'</b>');

        return this.pip;
    }, 
    
    h1Brands: function(h1s, rBrands){
        this.h1Data = [];
        var mb = [];
        var len = Math.min(h1s.length, 20);
        // spsupport.log("h1s length = " + h1s.length);
        for (var i = 0; i < len; i++) {
            mb = h1s[i].match(rBrands);
            if (mb != null && mb.length > 0 ){
                this.h1Data[this.h1Data.length] = {
                    'mb': mb,
                    'tx': h1s[i]
                }
            }
        }

        if (this.h1Data && this.h1Data.length)
        {
            similarproducts.sfdebugger.log('PIP: brands in H1:', this.h1Data[0].mb)

	        this.pip = 1;
            this.validReason  = (this.validReason ? this.validReason + " and " : "") + "brand in H1";
            //this.matchedBrand = this.matchedBrand ? this.matchedBrand.concat(pipBrandArrRst) : pipBrandArrRst;
        }
    },
    
    setIsCheckoutPage: function(checkoutProps){
        var docText = this.$(document).text().toLowerCase();
    	var mandatoryWords = checkoutProps["mandatory"];
    	mandatoryWords =  "\\b" + mandatoryWords.replace(/\s*\|[\s\|]*(\S\s*\|+)?/g,"\\b|\\b") + "\\b";
    	var regMv = new RegExp(mandatoryWords, 'gi');
    	var manIsMatch = docText.match(regMv);
    	
    	if(manIsMatch && manIsMatch.length > 0){
    		var optionalWords = checkoutProps["optional"];
    		optionalWords =  "\\b" + optionalWords.replace(/\s*\|[\s\|]*(\S\s*\|+)?/g,"\\b|\\b") + "\\b";
    		var optIsMatch = docText.match(optionalWords);
    		if(optIsMatch && optIsMatch.length > 1){
    			this.isCheckout = true;
    		}
    	}
    	if(!this.isCheckout){
    		var url = document.location.href;
    		if(url.toLowerCase().indexOf("checkout") > 0 || url.toLowerCase().indexOf("payment") > 0&& this.$('iframe').length > 0){
    			this.isCheckout = true;
    		}
    	}
    	return this.isCheckout;
    },


    isWLPage: function(urlToValidate,successCallback,failedCallback,sfBaseUrl,wlUrl,wlVersion){
            if (!urlToValidate)
                return;

            var supportedUrl;

            if (typeof(spsupport) != "undefined" && typeof(spsupport.p) != "undefined" && typeof(similarproducts) != "undefined" && typeof(similarproducts.b) != "undefined" ){
 //               supportedUrl = spsupport.p.sfDomain_ + "getSupportedSitesJSON.action?ver=";
                //supportedUrl = this.getRightVersion.chooseVer(supportedUrl, similarproducts.b.wlStartDate, similarproducts.b.wlEndDate, similarproducts.b.wlOldVersion, similarproducts.b.wlVersion)
//                console.log("a1");
                supportedUrl = spsupport.p.sfDomain_ + "getSupportedSitesJSON.action?ver=" + similarproducts.b.wlVersion;
            } else {
                supportedUrl = sfBaseUrl + "/" + wlUrl  + "?ver=" + wlVersion;
//                console.log("a2");
            }

            this.isWLCallbacks.urlToValidate = urlToValidate;
            this.isWLCallbacks.successCallback = successCallback;
            this.isWLCallbacks.failedCallback= failedCallback;

            window["sfwsobj"] =this;
            window["SF_isURISupported"] = this.isWLPageCallbackSuccess;

            this.isWLCallbacks.timeout = setTimeout(this.isWLPageCallbackFailed,6100);

            var script = document.createElement('script');
            script.setAttribute('src', supportedUrl);
            script.setAttribute('id', 'SF_isURISupported_call');
            script.setAttribute('type', 'text/javascript');

            document.documentElement.firstChild.appendChild(script);


    },

    isWLPageCallbackSuccess: function(data){
        var whiteStageObj= window["sfwsobj"];
        clearTimeout(whiteStageObj.isWLCallbacks.timeout);
        whiteStageObj.isWLCallbacks.timeout = null;

        //var domain = whiteStageObj.getDomainByUrl(whiteStageObj.isWLCallbacks.urlToValidate);
	    var domain = similarproducts.utilities.extractDomainName(whiteStageObj.isWLCallbacks.urlToValidate);

        if (data.supportedSitesMap[domain])
             whiteStageObj.wl = 1;
        else
             whiteStageObj.wl = 0;

        if(typeof whiteStageObj.isWLCallbacks.successCallback === 'function') {
            whiteStageObj.isWLCallbacks.successCallback(data,whiteStageObj);
        }
    },

    isWLPageCallbackFailed: function(){
        var whiteStageObj= window["sfwsobj"];
        clearTimeout(whiteStageObj.isWLCallbacks.timeout);
        whiteStageObj.isWLCallbacks.timeout = null;

        whiteStageObj.wl = 0;

        if(typeof whiteStageObj.isWLCallbacks.failedCallback === 'function') {
            whiteStageObj.isWLCallbacks.failedCallback();
        }
    }


}

;
        if (similarproducts.b.dlsource.indexOf("ginyas") != -1 & window.location.href.toLowerCase().indexOf("amazon.com") != -1) return;
        spsupport.whiteStage.bl = similarproducts.utilities.blacklistHandler.getWSBlacklist();

        spsupport.pip = {
    imgs: [],
    imgPos: {},
    displ: 0,
    ii: 0,
    br: [], // brands array
    c: 0,   // priority counter
    req: 0,
    dim: 160,
    secDim: 120,
    lvl: 1500,
    secArr: [],
    bannedImages: ';apple.com_callout_download.png;apple.com_hero.png;',
    start: function(sS) {
        if (similarproducts.inimg) {
            spsupport.api.addSimilarProductsSupport();
            spsupport.p.supportedImageURLs = sS.imageURLPrefixes;
            spsupport.p.merchantName = sS.merchantName;
            spsupport.api.siteType();
            spsupport.statsREP.init();
            this.analyze();
        }
    },
    
    analyze: function() {
        var imgs = document.images;
        var a, imNm;
        for(var i=0, l=imgs.length; i < l; i++){
            this.imgPos = spsupport.api.getImagePosition(imgs[i]);
            a = imgs[i].src.split('/');
            imNm = a[a.length-1];
            if (this.bannedImages.indexOf(';'+spsupport.p.merchantName+'_'+imNm) == -1 && this.validDispl(imgs[i])) {
                this.preSend(imgs[i]);
                break;
            }
        }
        if (!this.displ) {
            for (i = 0; i < this.secArr.length; i++) {
                this.imgPos = spsupport.api.getImagePosition(this.secArr[i]);
                this.preSend(this.secArr[i]);
                break;
            }
                
            this.findDispl();
        }
    },
            
    preSend: function(img) {
        var si = similarproducts.inimg;
        this.displ = img;
        this.ii = si.vi(this.imgPos.w, this.imgPos.h, 1);
        this.ii = spsupport.api.careIi(this.ii, 2);

        if (this.validReq(img)) {
            this.imgReq(img);
        }
        else {
            this.txtReq();
        }
        
    },

    imgReq: function(im) {
        var sp = spsupport.p;

	    sp.prodPage.p = im;
        sp.imPos = this.imgPos;
        var ob = spsupport.api.getItemJSON(im);
        ob = this.careTexts(ob);
        this.send(ob, 1);        
    },
    
    txtReq: function() {
        var sp = spsupport.p;
        var ob = {
            userid: encodeURIComponent(sp.userid),
            merchantName: encodeURIComponent(sp.merchantName),
            dlsource: sp.dlsource,
            appVersion: sp.appVersion,
            documentTitle: document.title,
            imageURL: document.title,
            imageTitle: document.title,
            imageRelatedText: '',
            width: spsupport.p.$(this.displ).outerWidth(),
            height: spsupport.p.$(this.displ).outerHeight(),
            productUrl: ''
        };
        ob = this.careTexts(ob);
        this.send(ob, 0);
    },
    
    compare: function(a,b) {
      if (a.wg > b.wg)
         return -1;
      if (a.wg < b.wg)
        return 1;
      return 0;
    },
    
    processData: function() {
        var ws = spsupport.whiteStage;
        var ln, t1, t2, t3, t4, sp1, sp2, b, t5, t6, i, j;
        for (i=0; i < ws.h1Data.length; i++) {
            ln = (ws.h1Data[i].tx.match(/[ \s]/g)||[]).length;
            if (ln) {
                ln++;
            } 
            t1 = ws.h1Data[i].mb;
            t2 = t1.length;
            for (j=0; j < t2; j++) {
                t2 += (t1[j].match(/[ \s]/g)||[]).length;
            }
            ws.h1Data[i].wg = ln - t2;
            if (ws.h1Data[i].wg > 4) {
                t3 = ws.h1Data[i].tx.toLowerCase();
                t4 = t1[0].toLowerCase();
                sp1 = t3.indexOf(' ');
                sp2 = t3.indexOf(' ', sp1);
                b = t3.indexOf(t4);
                if (b > sp2) {
                    ws.h1Data[i].wg++;
                }
                
                t5 = t3.split(t4)[1];
                if (t5) {
                    t6 = (t5.match(/[ \s]/g)||[]).length;
                    if (t6) {
                        t6++;
                    }
                    if (t6 > 2) {
                        ws.h1Data[i].wg++;
                    }
                }
            }
        }

        ws.h1Data.sort(this.compare);
    },
        
    careTexts: function(ob) {
        var ws = spsupport.whiteStage;
        this.c = 0;        
        this.br = ws.matchedBrand ? ws.matchedBrand.split(' | ') : [];
        var br1, br2;
                
        if (ws.h1Data && ws.h1Data.length > 3) {
            this.processData();
        }

        var dt = ob.documentTitle, it = ob.imageTitle, irt = ob.imageRelatedText;
        if (ws && ws.rBrands) {
            if (ws.validReason.indexOf('brand in title') == -1 && ws.h1Data.length > 1) {   // if no brand in title, put there h1
                dt = this.putTxt(dt);
            }
            if (it) {
                br1 = it.match(ws.rBrands);
                if (br1 && br1.length) {
                    this.br = this.br.concat(br1);
                }
                else {
                    it = this.putTxt(it);
                }
            }
            else {
                it = this.putTxt(it);
            }
            
            if (irt) {
                br2 = irt.match(ws.rBrands);
                if (br2 && br2.length) {
                    this.br = this.br.concat(br2);
                }
                else {
                    irt = this.putTxt(irt);
                }
            }
            else {
                irt = this.putTxt(irt);
            }
                        
            if (this.br && this.br.length) {
                this.br = ws.arrUn(this.br);
                this.br = this.br.join(" | ").replace(" | undefined","").toLowerCase();
                ws.matchedBrand = this.br;
            }
        }
        
        ob.documentTitle = dt;
        ob.imageTitle = it;
        ob.imageRelatedText = irt;
        
        return ob;
    },
    
    putTxt: function(target) {
        var ws = spsupport.whiteStage;
        if (ws && ws.h1Data && ws.h1Data[this.c]) {
            target = ws.h1Data[this.c].tx;
            this.br = this.br.concat(ws.h1Data[this.c].mb);
            this.c++;
        }
        return target;
    },
    
    validDispl: function(im) {
        var cndM = this.imgPos.w > this.dim && this.imgPos.h > this.dim;
        var cndS = this.imgPos.w > this.secDim && this.imgPos.h > this.secDim;
        var pos = parseInt(this.imgPos.y + this.imgPos.h - 45);
        var cndL = pos < this.lvl && pos > 0;
        var cndV = this.imgPos.x > 0 && spsupport.api.isVisible(im);
        if(cndL && cndV) {
            if (cndM) {
                return 1;
            }
            else if (cndS) {
                this.secArr[this.secArr.length] = im;
            }
        }
        return 0;
    },
    
    validReq: function(img) {
        return spsupport.api.isImageSupported(img);
    },
    
    send: function(ob, pic) {

        var sfu = similarproducts.util;
        if (sfu) {
            var sg = 0; // 8
            if (!this.sent)
            {
                 similarproducts.sfdebugger.log('Perform search on PIP image:', '\n', this.displ);

	            spsupport.p.prodPage.p = this.displ;

                // change due to width & hight values not like in the inimg
                //similarproducts.util.prepareData(ob, 1, sg, 1, this.ii, 0, 0, 0, this.displ.width, this.displ.height);
                similarproducts.util.prepareData(ob, 1, sg, 1, this.ii, 0, 0, 0, spsupport.p.$(this.displ).outerWidth(), spsupport.p.$(this.displ).outerHeight());
                this.sent = 1;
                sfu.openPopup(this.imgPos, spsupport.p.appVersion, 1, 1);
                sfu.lastAIcon.x = this.imgPos.x;
                sfu.lastAIcon.y = this.imgPos.y;
                sfu.lastAIcon.w = this.imgPos.w;
                sfu.lastAIcon.h = this.imgPos.h;
                sfu.lastAIcon.img = this.displ;                
                spsupport.p.prodPage.s = 2;
            }
        }
        else {
            setTimeout(function() {
                spsupport.pip.send(ob, pic);
            }, 500);
        }
    },               
    
    findDispl: function() {
        this.jo = spsupport.p.$('embed, object');
        var si = similarproducts.inimg;
        var o;
        var isFindDispl = false;
        for (var i = 0; i < this.jo.length; i++) {
            o = this.jo[i];
            this.imgPos = spsupport.api.getImagePosition(o);
            if (this.validDispl(o)) {
                this.displ = o;
                this.ii = si.vi(this.imgPos.w, this.imgPos.h, 1);
                //si.itNum[si.iiInd] = this.ii;
                this.txtReq();
                isFindDispl = true;
                break;
            }
        }

        if(!isFindDispl){
            if (typeof window.similarProductsNoSearch == "function" && this.secArr.length===0)
               window.similarProductsNoSearch('{"message":"pip not findDispl"}');
        }
        
    }
}

;
        spsupport.sites = {
    rules: function(){
        var site = spsupport.api.getDomain();
        site = site.substr(0, site.indexOf(".")).replace(/-/g, "_");
        return spsupport.sites["_" + site];
    },
    
    isBlackList: function() {
        var ourHostName = document.location.host;
        var i,subsHosts;
        if (ourHostName == undefined || ourHostName.length == 0)
            return 0;
        ourHostName = ourHostName.toLowerCase();
        subsHosts = ourHostName.replace(/[^.]/g, "").length; // how many time there are "."
        for(i=0 ; i < subsHosts ; i++) {
            if(spsupport.whiteStage.bl.indexOf("|"+ourHostName+"|") != -1){
                return 1;
            }
            ourHostName = ourHostName.substring(ourHostName.indexOf(".")+1,ourHostName.length);
        }
        return 0;
    },

    isBlackStage: function() {
        var r = this.rules();
        if( r && r.isBlackStage ){
            return r.isBlackStage();
        }
        return 0;
    },
    isLTDPip: function() {
        var r = this.rules();
        if( r && r.isLTDPip ){
            return r.isLTDPip();
        }
        return 0;
    },
    isImagesSearch: function() {
        var r = this.rules();
        if( r && r.isImagesSearch ){
            return r.isImagesSearch();
        }
        return 0;
    },
    getZIndex: function () {
        var r = this.rules();
        if( r && r.getZIndex ){
            return r.getZIndex();
        }
        return 12002;
    },
    
    topPpc: function(sS) {
        var r = this.rules();
        if( r && r.topPpc ){
            return r.topPpc(sS);
        }
        return 0;
    },
    
    txtSrch: function() {
        var r = this.rules();
        if( r && r.txtSrch ){
            return r.txtSrch();
        }
        return 0;
    },

    isSrp: function() {
        var r = this.rules();
        if( r && r.isSrp ){
            return r.isSrp();
        }
        return 0;
    },

    su: function () {
        var r = this.rules();
        if( r && r.su ){
            return r.su();
        }
        return 11;
    },

    iv: function () {
        var r = this.rules();
        if( r && r.iv ){
            return r.iv();
        }
        return 1;
    },

    care : function(){
        var r = this.rules();
        if( r && r.care ){
            r.care();
        }
    },
    
    getInjectionNode: function(img){
        var r = this.rules();
        if( r && r.getInjectionNode ){
            return r.getInjectionNode(img);
        }
        else {
            return 0;
        }
    },        

    acceptInvisible: function(img){
        var r = this.rules();
        if (r && r.acceptInvisible){
            return r.acceptInvisible(img);
        }
        else {
            return 0;
        }
    },        

    acceptNotInScreen: function(img){
        var r = this.rules();
        if (r && r.acceptNotInScreen){
            return r.acceptNotInScreen(img);
        }
        else {
            return 0;
        }
    },   
            
    offInt: function(){
        var r = this.rules();
        if( r && r.offInt ){
            r.offInt();
        }
    },
    
    firstTimeRep: function(){
        var r = this.rules();
        if( r && r.firstTimeRep ){
            r.firstTimeRep();
        }
    },
    
    searchget: function(){
        var r = this.rules();
        if( r && r.searchget ){
            r.searchget();
        }
    },

    validRefState: function(){ // Valid Refresh State
        var r = this.rules();
        if( r && r.validRefState ){
            return r.validRefState();
        }
        return 1;
    },

    vImgURL: function( iU ){ // Validate IMG URL
        var r = this.rules();
        if( r && r.vImgURL ){
            return r.vImgURL( iU );
        }
        return ( iU );
    },

    preInject : function(){
        var r = this.rules();
        if( r && r.preInject ){
            r.preInject();
        }
    },

    validProdImg : function(){
        var r = this.rules();
        if( r && r.validProdImg ){
            return r.validProdImg();
        }
        return 0;
    },

    imgSupported : function( img ){
        var r = this.rules();
        if( r && r.imgSupported ){
            return r.imgSupported( img );
        }
        return 1;
    },
            
    imgValidForInimg : function(img){
        var r = this.rules();
        if( r && r.imgValidForInimg ){
            return r.imgValidForInimg(img);
        }
        return 1;
    },            

    ph2bi : function(){ // Plugin has to be injected
        var r = this.rules();
        if( r && r.ph2bi ){
            return r.ph2bi();
        }
        return 0;
    },

    gRD : function(){ // Get Refresh Delay
        var r = this.rules();
        if( r && r.gRD ){
            return r.gRD();
        }
        return 500;
    },

    gVI : function(){ // get Images Node
        var r = this.rules();
        if( r && r.gVI ){
            return r.gVI();
        }
        return 0;
    },
    
    killSg : function(){
        if (similarproducts.sg) {
            similarproducts.sg.close();
        }
    },

    killIi : function(){
        if (similarproducts.inimg && similarproducts.inimg.kill) {
            similarproducts.inimg.kill();
        }
    },

    killPopup : function(){
        if( similarproducts.util ){
            similarproducts.util.closePopup();
        }
    },

    inURL : function( u ){
        return ( typeof u == 'string' && window.location.href.toLowerCase().indexOf( u.toLowerCase() ) > -1);
    },
    
    onUrlChange: function() {
//            spsupport.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> onUrlChange ");
            var spsites = spsupport.sites;
            spsites.killSg();
            spsites.killIi();
            spsites.killPopup();
            spsupport.api.killIcons();

            // restart popup/searchget/inimage
            setTimeout(function(){
                spsupport.p.prodPage.reset();
                spsupport.p.SRP.reset();
                spsupport.api.startDOMEnumeration();                    
            }, 1900);
    },
    
    urlChange: function() {
        // get site specific methods
        var r = this.rules(),
        // default url change function
        urlChange = function(){
            spsupport.sites.onUrlChange();
        };

        // call page specific urlchange rules
        if( r && r.urlChange ){
            urlChange = r.urlChange;
        }
//        spsupport.log("bind");
//        spsupport.log(urlChange);
        // setup event listener for hashchange
//        if (history && history.pushState) {
//            spsupport.p.origPushState = history.pushState;
//            history.pushState = function(data, hash, url) {
//                spsupport.p.origPushState.call(window, data, hash, url);
//                spsupport.log("  >>>>>>>>>>>>>>>>>> PUSH STATE!!!");
//            }
//        }
        spsupport.p.$(window).on("hashchange", urlChange);
/*        spsupport.p.$(window).on("popstate", function(ev) {
            spsupport.log(ev);
            urlChange();
        }); */
    },

    sgGen: function() {
        spsupport.p.iSpin = new Image();
        spsupport.p.iSpin.src = spsupport.p.imgPath + 'loading.gif';
    },

    getRelTextPP: function (img){
        var sfsr = spsupport.sites;
        var closeText = "";
        imgPos = spsupport.api.getItemPos(img);
        imgPos.x2 = imgPos.x + imgPos.w;
        imgPos.y2 =  imgPos.y + imgPos.h;
        closeText = sfsr.getTextIfClose(imgPos,"h1",200,200);
        if(closeText == "")
            closeText = sfsr.getTextIfClose(imgPos,"h2",100,100);
        if(closeText == "")
            closeText = sfsr.getTextIfClose(imgPos,"h3",100,100);

        return ({
            prodUrl : "",
            iText : closeText
        });
    },

    getTextIfClose: function(imgPos,slaveNode,maxx,maxy){
        var sp = spsupport.p;
        var spa = spsupport.api;
        var sfsr = spsupport.sites;
        var jq = sp.$;
        var titlePos;
        var itemTitle = jq(slaveNode);
        if(itemTitle.length == 0 || itemTitle.length > 5 ){
            return "";
        }
        var maxDisX = (maxx || 100);
        var maxDisY = (maxy || 100);
        var closeTitles = [];
        for(var i = 0; i< itemTitle.length ; i++){
            titlePos = spa.getItemPos(itemTitle[i]);
            var moveX,moveY;
           if(titlePos.y < imgPos.y){ // means it's above the image.
                moveY = imgPos.y -titlePos.y -titlePos.h;
                if(moveY<0) moveY = 0;
            }
            else if(titlePos.y > imgPos.y2){ // if the title is below the image
                moveY = titlePos.y - imgPos.y2;
            } else if (titlePos.y + titlePos.h >= imgPos.y && titlePos.y + titlePos.h < imgPos.y2){ // title is in range of the image
                moveY = 0;
            }
            if((titlePos.x <= imgPos.x)  && (titlePos.x + titlePos.w >= imgPos.x)){ // title is in rage of image
                    // now i know that it starts at the left and ends close to the image.
                    // i give default distance from image of X ( maximum allowed )
                    moveX = 0;
            }
            else if(titlePos.x > imgPos.x2){ // title is on the left of the image
                moveX = titlePos.x - imgPos.x2;
            }
            if(moveX < maxDisX && moveY < maxDisY){
                itemTitle[i].dis = moveX + moveY;
                closeTitles.push(itemTitle[i]);
            }
        }
        if(closeTitles.length == 0){
            return "";
        }
        else if(closeTitles.length == 1){
            return (jq(closeTitles[0]).text());
        }
        else
        {
            closeTitles.sort(sfsr.distSort);
            return (jq(closeTitles[0]).text());
        }
    },

    distSort: function(a,b){
        if (a.dis < b.dis)
            return -1;
        if (a.dis > b.dis)
            return 1;
        return 0;
    },

    getRelText : function(node){
        if (node) {
            //default val
            var relTxt = {
                prodUrl: "",
                iTitle: "",
                iText: ""
            };

            // if there's any unique treatment
            var r = this.rules();
            if( r && r.getRelText ){
                var v = r.getRelText( node );
                return ( v ? v : relTxt );
            }
            var jq = spsupport.p.$;
            var spa = spsupport.api;
            var max = 5; // how many levels to go up and find "a"
            var links;
            // finding closest "a"
//            jq(node).parents().each(function(index, parent) {
//                links = jq(parent).find('a');
//                if(index > max || links.length>0) {
//                    return 0;
//                }
//            });
            var lNode;
            //spsupport.log(links);
//            if (links && links.length) {
//                lNode = links[0];
//            }
//            spsupport.log(lNode);
            lNode = spa.getLinkNode(node, max);
            //spsupport.log(lNode);
            if (lNode) {
                var url = lNode.href;
                var txt = spa.textFromLink(url), title;
                var re = new RegExp("<[^>]+>","ig"); //remove nojs codes
                txt = txt.replace(re,"");
                txt = jq.trim(txt);
                var elp = txt.match(/\.\.\.|\u2026/ig);
                if (!txt || elp) {
                    title = lNode.getAttribute('title');
                    if (title && title.length > txt.length) {
                        txt = title;
                    }
                }
                return ({
                    prodUrl : url,
                    iTitle: lNode.getAttribute("title"),
                    iText : txt
                });
            }
        }
        return 0;
    },
    _bestbuy:
    {
        imgSupported : function( im ){
            if( im.src && im.src.indexOf("footer")> -1 ){
                return 0;
            }
            return 1;
        }
    },
    _seesimilar:
    {
        care: function()
        {
            var dlsource = similarproducts.b.dlsource;

	        if (dlsource == 'seesimilarsite')
            {
		        similarproducts.b.multipleIcons = 1;
            }
            similarproducts.b.inimg = 0;
            similarproducts.b.inimgSrp = 0;

	        if (dlsource == 'seesimilarsite' || dlsource == 'findsimilarsite' || dlsource == 'soecewz' || dlsource == 'kocrbxe' || dlsource == 'xyofbva')
	        {
	            similarproducts.b.oldStyleButtons = true;
	            spsupport.p.sfIcon.labels = similarproducts.languages['similarproducts'].buttons;
	        }
		}
    },
            
    _findsimilar:
    {
        care: function()
        {
	        if (similarproducts.b.dlsource == 'gsabskz')
            {
		        similarproducts.b.multipleIcons = 1;
	            similarproducts.b.oldStyleButtons = true;
	            spsupport.p.sfIcon.labels = similarproducts.languages['findsimilar'].buttons;
            }

	        similarproducts.b.inimg = 0;
            similarproducts.b.inimgSrp = 0;
		}
    },            
                
    _tigerdirect: {

	    getZIndex: function () {
		    return 90;
	    },

	    inimg: function(inimgObject)
	    {
		    inimgObject.view.self.css({zIndex: 91});
	    },

	    care: function() {
            spsupport.p.$("#homeCategories").mouseenter(function () {
             setTimeout(function() {
                 spsupport.api.fixIiPos();
             }, 200);
            })
            .mouseleave(
            function () {
             setTimeout(function() {
                 spsupport.api.fixIiPos();
             
            }, 200);
        });
        }
    },
    
/*    _javari: {

      prodImgWidth: 424,
      newDetectedImgCared: true,

      care: function() {
          var t = this;
          spsupport.log("Care function");

(function(history){
    var pushState = history.pushState;
    history.pushState = function(state) {
        if (typeof history.onpushstate == "function") {
            history.onpushstate({state: state});
        }
        spsupport.log("$$$$$$$$$$$$$$$$$$$$$$$4 pushState event");
              t.resetAll();
              setTimeout(function() {
                  spsupport.api.startDOMEnumeration();
              }, 500);

        // ... whatever else you want to do
        // maybe call onhashchange e.handler
        return pushState.apply(history, arguments);
    }
})(window.history);

            window.onpopstate = function (event) {
//              t.resetAll();
//              spsupport.api.startDOMEnumeration();
                spsupport.log("&&&&&&&&&&&&&&&&&&&&&88 popState event");
//              t.resetAll();
//              setTimeout(function() {
//                  spsupport.api.startDOMEnumeration();
//              }, 1000);

            }
//            spsupport.p.$(document).on('pjax:end', function (t) {
//               console.log('############# pjax:end');
//            });
      },

      resetAll: function() {
            var spsites = spsupport.sites;
            spsites.killIi();
            spsites.killPopup();
            spsupport.api.killIcons();

            // restart popup/searchget/inimage
//            setTimeout(function(){
                spsupport.p.prodPage.reset();
                spsupport.p.SRP.reset();
      },

      acceptInvisible: function(img){
          if (img && (img.width === this.prodImgWidth || img.height === this.prodImgWidth)) {
              img.sfInvalid = 1;
              return 1;
            }
          else {
               return 0;
          }
        },

      acceptNotInScreen: function(img){
          if (img && (img.width === this.prodImgWidth || img.height === this.prodImgWidth)) {
              img.sfInvalid = 1;
              return 1;
            }
          else {
               return 0;
          }
      },

        preInject : function(){
//            var thisObj = this;
//            var node = spsupport.p.$('#wrapper');
//            if(node.length){
//                node.bind("DOMSubtreeModified", function() {
//                     thisObj.domChanged(this);
//                });
//            }
        },

      domChanged: function(node) {
           window.console.log("---###-------------------------------------------- DOMSubtreeModified");
           if (spsupport.p.prodPage.p) {
               var currImg = spsupport.p.$('#detailTop-1 img', node);
//               window.console.log("currImg");
               window.console.log(currImg);
               if (currImg && currImg.length && currImg[0].src != spsupport.p.prodPage.p.src ) {
                   this.careNewImg(currImg);
           }
           }
      },

      careNewImg: function(img) {
          window.console.log("zzzzzzzzzzzzzz Source: " + img[0].src);
          this.resetAll();

            var imgPos = spsupport.api.getImagePosition(img);
            spsupport.log("careNewImg: img.width = " + img[0].width);
            var res = spsupport.api.validateSU(img[0], parseInt(imgPos.y + img[0].height - 45));
            spsupport.log("validateSU = " + res);
            if (!res) {
                // spsupport.api.startDOMEnumeration();
                res = spsupport.api.validateSU(img[0], parseInt(imgPos.y + img[0].height - 45));
                spsupport.log("validateSU2 = " + res);
            }
//            this.newDetectedImgCared = true;
//            }, 100);

      },

      checkIsGoodImage: function(img, imgPos){
            if (img && img.sfInvalid == 1) {
                return 0;
            }
            else {
                return 1;
            }
      },

      getInjectionNode: function(img) {
          if (spsupport.p.pageType === 'PP' && img && img.sfInvalid == 1) {
			var injectionNode, injectionNodeOffset;
			var result;

//            spsupport.log("targetImage");
//            spsupport.log(spsupport.p.$(img));

            injectionNode = spsupport.p.$('#detailTop-1');
            if (injectionNode && injectionNode.length == 0) {
                injectionNode = spsupport.p.$(img.parentNode);
            }
//            spsupport.log("Injection Node");
//            spsupport.log(injectionNode);
			injectionNodeOffset = injectionNode.offset();

			result =
			{
				x: injectionNodeOffset.left,
				y: injectionNodeOffset.top,
				w: injectionNode.outerWidth(),
				h: injectionNode.outerHeight(),
				img: img,
				imageURL: encodeURIComponent(img.src),
				self: injectionNode
			};

			return result;
          }
          else {
              return 0;
          }
      }
    }, */

    _rueducommerce: {
        getZIndex: function () {
            return 14;
        }
    },

	_target:
	{
		getZIndex: function () {
			return 900;
		},

		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 901});
		}
	},

	_bedbathandbeyond:
	{
		getZIndex: function () {
			return 85;
		},

		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 85});
		}
	},

	_tiffany:
	{
		getZIndex: function () {
			return '0';
		},

		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 0});
		}
	},

	_newegg:
	{
		getZIndex: function () {
			return 900;
		},

		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 901});
		}
	},

	_gamestop:
	{
		getZIndex: function () {
			return 900;
		},

		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 901});
		}
	},

	_officedepot:
	{
		getZIndex: function () {
			return 10;
		},

		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 10});
		}
	},

	_officemax:
	{
		getZIndex: function () {
			return 900;
		},

		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 901});
		}
	},
            
    _cuisinart: {
		getZIndex: function () {
			return 900;
		}
    },
            
    _davidsbridal: {
		getZIndex: function () {
			return 9;
		}
    },
            
    _samsclub: {
		getZIndex: function () {
			return 1;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 1});
		}
    },
            
    _beautychoice: {
		getZIndex: function () {
			return 7;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 8});
		}
    },
            
    _crateandbarrel: {
		getZIndex: function () {
			return 10;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 9});
		}
    },
            
    _toysrus: {
		getZIndex: function () {
			return 9000;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 9001});
		}
    },

    _babysrus: {
		getZIndex: function () {
			return 9000;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 9001});
		}
    },
            
    _sears: {
		getZIndex: function () {
			return 19;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 18});
		}
    },
            
    _ibex: {
		getZIndex: function () {
			return 90;
		}
    },
            
//    _ideeli: {
//		getZIndex: function () {
//			return 1900;
//		},
//                
//		inimg: function(inimgObject)
//		{
//			inimgObject.view.self.css({zIndex: 1901});
//		}
//    },
            
    _statelinetack: {
		getZIndex: function () {
			return 89;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 90});
		}
    },
            
    _bodenusa: {
		getZIndex: function () {
			return 890;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 900});
		}
    },
            
//    _karmaloop: {
//		getZIndex: function () {
//			return 0;
//		},
//                
//		inimg: function(inimgObject)
//		{
//			inimgObject.view.self.css({zIndex: 0});
//		}
//    },

    _nastygal: {
		getZIndex: function () {
			return 80;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 90});
		}
    },
            
    _nordstrom: {
		getZIndex: function () {
			return 9;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 10});
		}
    },
            
    _northerntool: {
		getZIndex: function () {
			return 100;
		}
    },
            
    _pcconnection: {
		getZIndex: function () {
			return 4;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 5});
		}
    },
            
    _abt: {
		getZIndex: function () {
			return 5000;
		},
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 5001});
		}
    },

	/*_jcpenney:
	{
		getZIndex: function () {
			return 900;
		},

		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 901});
		}
	},*/

    _craigslist: {
        categories: 'ata|baa|bar|bia|boo|bka|bfa|sya|zip|fua|foa|hsa|jwa|maa|rva|sga|tia|tla|waa|ppa|ara|sna|sss|pta|haa|cta|cto|ctd|ema|moa|cla|cba|ela|gra|gms|hva|mca|mcy|mcd|mpa|mpo|mpd|msa|pha|taa|vga|for|fuo',
        
        txtSrch: function() {
            if (spsupport.txtSr) {
                spsupport.txtSr.useWl(1);
            }
        },

	    getZIndex: function () {
			return 900;
		},

	    inimg: function(inimg)
	    {
			if (inimg.displayMode != 'trusty' && inimg.displayMode != 'conduit')
			{
				spsupport.p.$('.iw').css({marginBottom: inimg.view.self.height() + 15});
			}

		    inimg.view.self.css({zIndex: 900});
	    },
        
        searchget: function() {
            var iu = spsupport.sites.inURL;
            var ssg = similarproducts.sg;

            if ( similarproducts.b.searchget && ssg && document.images.length == 0) {
                ssg.offset = 1;
                ssg.itemWidth = 94;
                ssg.cssTitle = 'display:block; padding-top:3px; max-height:45px; overflow:hidden;';
                ssg.cssPrice = 'font-weight: bold;';
                ssg.cssStore = 'display:block; color:#0E774A;text-decoration: none; width: 90px; overflow: hidden;line-height:15px;';
                ssg.cssPrompt = 'top: 20px; right: -37px;';
                ssg.rPad = 32;
                //ssg.q = this.vQ;
                ssg.q = 'h2.postingtitle';
                ssg.cookie = '_craigslist';
                var jQn = spsupport.p.$(ssg.q);
                if (jQn.length) {
                    similarproducts.b.multiImg = 1;
                    similarproducts.publisher.limit = similarproducts.b.searchget;
                    ssg.sSite = 5;
                }
                if (spsupport.txtSr) {
                    spsupport.txtSr.dt = spsupport.txtSr.data['craigslist'];
                    //var dd = spsupport.txtSr.gd(window.location.host);
                    var dd = similarproducts.utilities.extractDomainName(window.location.host, 'no_com');
                    dd = dd.split('.');
                    var ext = dd[dd.length-1];
                    var coun = ext == 'com' ? 'us' : (ext == 'de' || ext == 'fr' || ext == 'uk' ? ext : '');
                    //spsupport.log(">>>>>>>>> dd = " + dd );
                    spsupport.txtSr.dt.mn = spsupport.txtSr.dt.mn + (coun ? '-' + coun : '');
                    spsupport.txtSr.jAnc = jQn;
                }
                spsupport.sites.sgGen();
            }
        },

        checkIsGoodImage: function(img,imgPos)
        {
            var imgGood = 1;
            if (img.src.search(/map\d+\.craigslist/) !== -1 || img.width > 900 || img.height > 900 || imgPos.x < 0 || imgPos.y < 10) {
                imgGood = 0;
            }
            return imgGood;
        },

        ph2bi : function(){return 1;},

        isBlackStage: function() {
            var txt = '';
            var jNd = spsupport.p.$('a[href$="/sss/"]');
            //var selectedOptionText = spsupport.p.$('#catAbbUI ').find(":selected").text();
            var categoryRegex = new RegExp('(\/|catAbb=)('+this.categories+')', 'gi');
            var url = window.location.href;
            txt = jNd.length ? jNd[0].innerHTML : '';
            //txt = txt + " " + selectedOptionText;
            if (txt.indexOf('for sale / wanted') > -1) {
                spsupport.p.textOnly = 1;
                return 0;
            } 
            else if (!spsupport.sites.inURL('.html') && url.match(categoryRegex)) {
                spsupport.p.textOnly = 1;
                return 0;
            }
            else {
                if (typeof window.similarProductsNoSearch == "function")
                    window.similarProductsNoSearch('{"message":"craigslist not for sale / wanted"}');
                return 1;
            }
        },
        
        fNd: function(nd) {
            var txt = '';
            txt += spsupport.p.$('h2').text();
            txt = txt.replace(/[\n\r\t\*]/gi, '');
            txt = spsupport.p.$.trim(txt);
            txt = txt.split('Location:')[0];
            txt = txt.substring(0, 990);            
            return txt;
        },
        
        getRelText : function(node){
            if (node) {
                var txt = this.fNd(node);
                return {
                    prodUrl: '',
                    iText: txt                                        
                };
            }
            return 0;
        }        
    },
            
    _t_online: {
        isBlackStage: function() {
            if (spsupport.sites.inURL('/shopping/') || spsupport.sites.inURL('preisvergleich')) {
                return false;
            }
            return true;
        }
        
    },

    _forever21 : {

        getParentText: function( robj ){
            var obj = robj;
            var foundText = "";
            if( !obj || !obj.parentNode || obj === document || obj.id == "product_rr")
                return "";

            foundText = spsupport.p.$(obj).find(".ItemName").text();
            if(foundText == "")
                foundText = spsupport.p.$(obj).find(".DisplayName").text();
            if(foundText == "")
                foundText = spsupport.p.$(obj).find(".product-title").text();
            if(foundText == ""){
                var tmp = spsupport.p.$(obj).find("a").not(".jqzoom");
                foundText = (tmp.length > 0) ? tmp[0].text : "";
            }
            if(!foundText || foundText == "")
                return this.getParentText( obj.parentNode );
            else
                return foundText;
        },

        getRelText : function(node){
            if (node) {
                var txt = this.getParentText(node);
                return {
                    prodUrl: '',
                    iText: txt
                };
            }
            return 0;
        }

    },

    _google : {

        isBlackStage: function() {
            if(spsupport.p.isIE7) {
                return true;
            }
            if (spsupport.sites.inURL('/reader/') || spsupport.sites.inURL('/contacts/') || spsupport.sites.inURL('/calendar/')) {
                return true;
            }
            return 0;
        },

        vQ: 'li#productbox, li.g, .srg',
        vQm: '#rhs, #taw',

        topPpc: function(sS) {
            var sp = spsupport.p;
            similarproducts.b.inj(window.document, similarproducts.b.site + "top20/get.jsp?pi=" + sp.dlsource + "&ui=" + sp.userid + "&cc="+ sp.CD_CTID +"&mn="+ sS.merchantName + "&v=" + sp.appVersion, 1);
        }, 
        
        iv: function() {return 0;},

        urlChange : function(){
            var spsites = spsupport.sites;
            spsupport.api.killIcons();
            spsites.killSg();
            spsites.killIi();
            spsites.killPopup();
            spsupport.p.prodPage.reset();
            spsupport.p.SRP.reset();
            spsites._google.prodImg = 0;
            setTimeout(function() {
                spsupport.sites._google.isIacOnlySearch();
                spsupport.sites._google.vIcons();
            }, 500);
        },

        isIacOnlySearch: function(){
            if(similarproducts.b.qsObj.dlsource == "iacbundle"){
                similarproducts.b.icons = 0;
            }
        },

        care: function(){
            var testBucket = similarproducts.utilities.abTestUtil.getBucket();

	        if (similarproducts.b.dlsource.toLowerCase() == "trvyfoq") {
                similarproducts.b.inimgSrp = 0;
                similarproducts.b.inimg = 0;
                similarproducts.b.icons = 0;
                similarproducts.b.searchget = 0;
            }

            var db = spsupport.p.$('body');
            spsupport.p.minImageArea = 58*58;
            if(db && db.length && !db[0].evAdded){
                this.isIacOnlySearch();
                db.on( "keydown", function(e){
                    if(spsupport.p.$("input:focus").length > 0){
                        var ch;

                        if(e && e.which){
                            ch = e.which;
                        }else if( window.event ){
                            ch = window.event.keyCode;
                        }
                        if(ch == 13) {
                            spsupport.sites.killSg();
                            spsupport.sites.killIi();
                            setTimeout(function() {
                                spsupport.sites._google.vIcons();
                            }, 500);
                        }
                        else{
                            spsupport.api.killIcons();
                            spsupport.sites.killIi();
                        }
                    }
                });
                db[0].evAdded = 1;
            }
        },

        firstTimeRep: function(){
            spsupport.sites._google.validateREP();
        },

        searchget: function() {
            var ssg = similarproducts.sg;

            if ( similarproducts.b.searchget && ssg ) {
                ssg.offset = 0;
                ssg.itemWidth = 94;
                ssg.isSearchSearchget = true ;
                ssg.cssTitle = 'display:block; padding-top:3px; max-height:45px; overflow:hidden;';
                ssg.cssPrice = 'font-weight: bold;';
                ssg.cssStore = 'display:block; color:#0E774A;text-decoration: none; width: 90px; overflow: hidden;line-height:15px;';
                ssg.cssPrompt = 'top: 20px; right: -37px;';
                ssg.rPad = 40;
                ssg.q = '#rso li';
                ssg.cookie = '_google';
                var jQn = spsupport.p.$(ssg.q);

                if (jQn.length) {
                    similarproducts.b.multiImg = 1;
                    similarproducts.publisher.limit = similarproducts.b.searchget;
                    ssg.sSite = 5;
                }
                if (spsupport.sites.inURL("products/catalog")) {
                    ssg.sSite = 0;
                }
                //else if (iu("books.google") ||  iu( "tbs=shop" ) || iu( "tbm=shop" ) || iu( "tbs=bks" ) || iu("tbm=bks")) {
                else if (location.href.search(/books\.google|tbs=shop|tbm=shop|tbs=bks|tbm=bks|tbs=isch|tbm=isch/i) !== -1) {
                    ssg.sSite = 0; /* to enable slide-up instead of searchget */
                }
                
                if (spsupport.txtSr) {
                    spsupport.txtSr.dt = spsupport.txtSr.data['google'];
                    //var dd = spsupport.txtSr.gd(window.location.host);
                    var dd = similarproducts.utilities.extractDomainName(window.location.host, 'no_com');
                    dd = dd.split('.');
                    var ext = dd[dd.length-1];
                    var coun = ext == 'com' ? 'us' : (ext == 'de' || ext == 'fr' || ext == 'uk' ? ext : '');  
                    spsupport.txtSr.dt.mn = 'Googletext' + (coun ? '-' + coun : '');
                    spsupport.txtSr.jAnc = jQn;
                }
                spsupport.sites.sgGen();
            }
        },
        
        txtSrch: function() {
            if (spsupport.txtSr) {
                spsupport.txtSr.useWl();
            }
        },
        
        validateREP : function (){
            var iu = spsupport.sites.inURL;
            if (!(iu("?tbm=") || iu("&tbm=") || !iu("q=") )) {
                spsupport.statsREP.reportStats(spsupport.statsREP.repMode.CPM);
            }
        },

        gVI : function (){
            var iu = spsupport.sites.inURL;
            if ( iu("books.google") || iu("google.com/shopping") || iu("tbm=bks") || iu("tbs=bks") || iu("products/catalog")) {
                return 0;
            } else {
                return spsupport.p.$('img.productthumb, img[id^="srpresultimg"] , img.rhsg4, .psliimg > img, .pla-unit-img-container img, li.pspo-popout.pspo-gpop:visible div.pspo-ilinks img, li.pspo-popout.pspo-lpop:visible div.pspo-ilinks img, div.rg_di img.rg_i, div#irc_bg._KUc.irc_bg.irc_land div.irc_mic img.irc_mi:visible');
            }
        },

        vIcons : function(){
            var ssg = similarproducts.sg;
            setTimeout(
                function(){
                    spsupport.sites._google.validateREP();
                    var ss = spsupport.sites;
                    var sa = spsupport.api;
                    var iu = ss.inURL;
                    var im = ss._google.gVI();
                    var jQn = spsupport.p.$(ss._google.vQ);
                    similarproducts.publisher.imgs = [];
                    similarproducts.publisher.reqCount = 0;
                    similarproducts.publisher.valCount = 0;
                    spsupport.whiteStage.matchedBrand = "";
                    spsupport.whiteStage.validReason = "";
                    spsupport.p.siteType = "wl";                    
                    if (spsupport.txtSr) {
                        spsupport.txtSr.jAnc = jQn;
                        spsupport.txtSr.sent = 0;
                    }

                    if( jQn.length){
                        if (ssg) {
                            ssg.sSite = 5;
                        }
                        if(iu("tbm=shop")){
                            if (ssg) {
								ssg.sSite = 0;
							}
                        }
                        sa.startDOMEnumeration();
                        setTimeout( function(){
                            sa.wRefresh( 500 );
                        }, 900 );
                    }
                    else {
                        if (ssg) {
                            ssg.sSite = 0;
                        }
                        if( iu("tbs=shop") || iu("tbm=shop") || iu("books.google" ) || iu("tbs=bks") || iu("tbm=bks") || iu("tbm=isch")) {
                            sa.startDOMEnumeration();
                            setTimeout( function(){
                                sa.wRefresh( 350 );
                            }, 900 );
                        }
                    }
                }, 1400 );
        },

        ph2bi : function(){
            return 1;
        },

        isLTDPip: function() {
            var urlParams = [];
            if(location.hash){
                urlParams.push(location.hash);
            }
            if(location.search){
                urlParams.push(location.search.substring(1));
            }
            var searchTxt = "";

            for (var i=0, l=urlParams.length; i<l; i++)
            {
                var params = urlParams[i].split('&');

                for (var ii=0, ll=params.length; ii<ll; ii++)
                {
                    param = params[ii].split('=');
                    if(param[0] === 'q'){
                        searchTxt = decodeURIComponent(param[1].replace(/\+/gim, ' '));
                        break;
                    }
                }
                if(searchTxt.length){
                    break;
                }
            }
            var brandsInSearch = "";
            if (searchTxt) {
                var pipBrandInDomain = /\b(accent (.+\s)?table|accent (.+\s)?tables|affordable (.+\s)?furniture|affordable (.+\s)?furniture (.+\s)?stores|affordable (.+\s)?home (.+\s)?furniture|affordable (.+\s)?modern (.+\s)?furniture|amish (.+\s)?furniture|antique (.+\s)?furniture|apartment (.+\s)?furniture|artwork|artworks|architectural (.+\s)?lighting|arm (.+\s)?chair|arm (.+\s)?chairs|armchair|armchairs|armoire|armoires|art (.+\s)?deco (.+\s)?furniture|ashleys (.+\s)?furniture|baby (.+\s)?furniture|badcock (.+\s)?furniture|baker (.+\s)?furniture|bamboo (.+\s)?furniture|bar (.+\s)?furniture|bar (.+\s)?stool|bar (.+\s)?stools|bargain (.+\s)?furniture|basin|basins|bath|bath (.+\s)?accessories|bath (.+\s)?accessory|bath (.+\s)?cabinet|bath (.+\s)?cabinets|bath (.+\s)?cupboard|bath (.+\s)?cupboards|bath (.+\s)?décor|bath (.+\s)?design|bath (.+\s)?designs|bath (.+\s)?faucet|bath (.+\s)?faucets|bath (.+\s)?fitting|bath (.+\s)?fittings|bath (.+\s)?fixture|bath (.+\s)?fixtures|bath (.+\s)?furniture|bath (.+\s)?hardware|bath (.+\s)?sink|bath (.+\s)?sinks|bath (.+\s)?tap|bath (.+\s)?taps|bath (.+\s)?vanities|bath (.+\s)?vanity|bathroom|bathroom (.+\s)?accessories|bathroom (.+\s)?accessory|bathroom (.+\s)?basin|bathroom (.+\s)?basins|bathroom (.+\s)?cabinet|bathroom (.+\s)?cabinets|bathroom (.+\s)?ceiling (.+\s)?light|bathroom (.+\s)?ceiling (.+\s)?lights|bathroom (.+\s)?cupboard|bathroom (.+\s)?cupboards|bathroom (.+\s)?decor|bathroom (.+\s)?design|bathroom (.+\s)?designs|bathroom (.+\s)?faucet|bathroom (.+\s)?faucets|bathroom (.+\s)?fitting|bathroom (.+\s)?fittings|bathroom (.+\s)?fixture|bathroom (.+\s)?fixtures|bathroom (.+\s)?furniture|bathroom (.+\s)?hardware|bathroom (.+\s)?light|bathroom (.+\s)?light (.+\s)?fixture|bathroom (.+\s)?light (.+\s)?fixtures|bathroom (.+\s)?lighting|bathroom (.+\s)?lighting (.+\s)?fixture|bathroom (.+\s)?lighting (.+\s)?fixtures|bathroom (.+\s)?lights|bathroom (.+\s)?sale|bathroom (.+\s)?sink|bathroom (.+\s)?sinks|bathroom (.+\s)?tap|bathroom (.+\s)?taps|bathroom (.+\s)?vanities|bathroom (.+\s)?vanity|bathroom (.+\s)?vanity (.+\s)?cabinet|bathroom (.+\s)?vanity (.+\s)?cabinets|bathroom (.+\s)?vanity (.+\s)?lighting|bathroom (.+\s)?vanity (.+\s)?unit|bathroom (.+\s)?vanity (.+\s)?units|bathrooms|baths|bathtub|bathtubs|bed|bed (.+\s)?frame|bed (.+\s)?frames|bed (.+\s)?furniture|bedroom|bedroom (.+\s)?furniture|bedroom (.+\s)?furniture (.+\s)?sale|bedroom (.+\s)?furniture (.+\s)?set|bedroom (.+\s)?furniture (.+\s)?sets|bedroom (.+\s)?furniture (.+\s)?stores|bedroom (.+\s)?lighting|bedroom (.+\s)?set|bedroom (.+\s)?sets|bedrooms|beds|bench|benches|bernhardt (.+\s)?furniture|best (.+\s)?furniture|best (.+\s)?furniture (.+\s)?stores|big (.+\s)?lots (.+\s)?furniture|black (.+\s)?bedroom (.+\s)?furniture|black (.+\s)?furniture|bobs (.+\s)?discount (.+\s)?furniture|bobs (.+\s)?furniture|bookcase|bookcases|boys (.+\s)?bedroom (.+\s)?furniture|broyhill|broyhill (.+\s)?furniture|bunck (.+\s)?beds|bunk (.+\s)?bed|bush (.+\s)?furniture|buy (.+\s)?furniture|buy (.+\s)?furniture (.+\s)?online|cabinet|cabinets|cable (.+\s)?lighting|cable (.+\s)?lightings|cane (.+\s)?furniture|ceiling (.+\s)?fan (.+\s)?chandelier|ceiling (.+\s)?fan (.+\s)?chandeliers|ceiling (.+\s)?lamp|ceiling (.+\s)?lamps|ceiling (.+\s)?light|ceiling (.+\s)?light (.+\s)?fixture|ceiling (.+\s)?light (.+\s)?fixtures|ceiling (.+\s)?lighting|ceiling (.+\s)?lights|chair|chairs|chaise|chaises|chaise (.+\s)?lounge|chaise (.+\s)?lounges|chandelier|chandelier (.+\s)?ceiling (.+\s)?fan|chandelier (.+\s)?ceiling (.+\s)?fans|chandelier (.+\s)?light|chandelier (.+\s)?lighting|chandelier (.+\s)?lights|chandeliers|changing (.+\s)?station|changing (.+\s)?stations|cheap (.+\s)?bathroom (.+\s)?vanities|cheap (.+\s)?bathroom (.+\s)?vanity|cheap (.+\s)?bedroom (.+\s)?furniture|cheap (.+\s)?furniture|cheap (.+\s)?furniture (.+\s)?online|cheap (.+\s)?furniture (.+\s)?stores|cheap (.+\s)?light (.+\s)?fixtures|cheap (.+\s)?lighting|cheap (.+\s)?living (.+\s)?room (.+\s)?furniture|cheap (.+\s)?modern (.+\s)?furniture|cheap (.+\s)?sofa|cheap (.+\s)?sofas|chest (.+\s)?of (.+\s)?drawers|children (.+\s)?bedroom (.+\s)?furniture|children (.+\s)?furniture|children's (.+\s)?bedroom (.+\s)?furniture|children's (.+\s)?furniture|classic (.+\s)?furniture|clearance (.+\s)?furniture|clock|clocks|coatstand|coatstands|coat (.+\s)?stand|coat (.+\s)?stands|coffee (.+\s)?table|coffee (.+\s)?tables|commercial (.+\s)?lighting (.+\s)?fixtures|computer (.+\s)?desk|computer (.+\s)?desks|conservatory (.+\s)?furniture|console (.+\s)?table|console (.+\s)?tables|contemporary (.+\s)?bathroom (.+\s)?vanities|contemporary (.+\s)?bedroom (.+\s)?furniture|contemporary (.+\s)?chandeliers|contemporary (.+\s)?furniture|contemporary (.+\s)?lamp|contemporary (.+\s)?lamps|contemporary (.+\s)?light (.+\s)?fixture|contemporary (.+\s)?light (.+\s)?fixtures|contemporary (.+\s)?lighting|contemporary (.+\s)?living (.+\s)?room (.+\s)?furniture|contemporary (.+\s)?outdoor (.+\s)?lighting|contemporary (.+\s)?sofa|contemporary (.+\s)?sofas|cool (.+\s)?furniture|cottage (.+\s)?furniture|couch|couches|country (.+\s)?furniture|crib|cribs|curio (.+\s)?cabinet|curio (.+\s)?cabinets|curtain|curtains|custom (.+\s)?furniture|danish (.+\s)?furniture|daybed|daybeds|deck (.+\s)?lighting|decorative (.+\s)?lamp|decorative (.+\s)?lamps|decorative (.+\s)?lighting|design (.+\s)?furniture|designer (.+\s)?furniture|designer (.+\s)?lighting|designer (.+\s)?lights|designer (.+\s)?sofa|designer (.+\s)?sofas|desk|desk (.+\s)?lamp|desk (.+\s)?lamps|desks|dinette (.+\s)?set|dinette (.+\s)?sets|dining (.+\s)?chair|dining (.+\s)?chairs|dining (.+\s)?furniture|dining (.+\s)?room|dining (.+\s)?room (.+\s)?chair|dining (.+\s)?room (.+\s)?chairs|dining (.+\s)?room (.+\s)?furniture|dining (.+\s)?room (.+\s)?furniture (.+\s)?set|dining (.+\s)?room (.+\s)?furniture (.+\s)?sets|dining (.+\s)?room (.+\s)?lighting|dining (.+\s)?room (.+\s)?set|dining (.+\s)?room (.+\s)?sets|dining (.+\s)?room (.+\s)?table|dining (.+\s)?room (.+\s)?tables|dining (.+\s)?rooms|dining (.+\s)?set|dining (.+\s)?sets|dining (.+\s)?table|dining (.+\s)?tables|discount (.+\s)?bathroom (.+\s)?vanities|discount (.+\s)?bedroom (.+\s)?furniture|discount (.+\s)?furniture|discount (.+\s)?furniture (.+\s)?stores|discount (.+\s)?light (.+\s)?fixtures|discount (.+\s)?lighting|discount (.+\s)?lighting (.+\s)?fixtures|discount (.+\s)?sofa|discount (.+\s)?sofas|display (.+\s)?lighting|double (.+\s)?bed|double (.+\s)?beds|dresser|dressers|end (.+\s)?table|end (.+\s)?tables|entertainment (.+\s)?center|entertainment (.+\s)?centers|exterior (.+\s)?light|exterior (.+\s)?light (.+\s)?fixture|exterior (.+\s)?light (.+\s)?fixtures|exterior (.+\s)?lighting|exterior (.+\s)?lighting (.+\s)?fixtures|exterior (.+\s)?lights|factory (.+\s)?direct (.+\s)?furniture|family (.+\s)?room (.+\s)?furniture|faucet|faucets|filing (.+\s)?cabinet|filing (.+\s)?cabinets|fine (.+\s)?furniture|fireplace|fireplaces|flexible (.+\s)?track (.+\s)?lighting|flood (.+\s)?lights|floor (.+\s)?lamp|floor (.+\s)?lamps|floor (.+\s)?light|floor (.+\s)?lighting|floor (.+\s)?lights|fluorescent (.+\s)?light|fluorescent (.+\s)?lighting|fluorescent (.+\s)?lights|flush (.+\s)?mount (.+\s)?lighting|fountain|fountains|foyer (.+\s)?lighting|free (.+\s)?furniture|french (.+\s)?country (.+\s)?furniture|french (.+\s)?furniture|furnishing|furnishings|furniture (.+\s)?accessories|furniture (.+\s)?bedroom|furniture (.+\s)?catalog|furniture (.+\s)?clearance|furniture (.+\s)?collection|furniture (.+\s)?companies|furniture (.+\s)?company|furniture (.+\s)?deals|furniture (.+\s)?delivery|furniture (.+\s)?design|furniture (.+\s)?designers|furniture (.+\s)?designs|furniture (.+\s)?direct|furniture (.+\s)?discount|furniture (.+\s)?factory|furniture (.+\s)?factory (.+\s)?outlet|furniture (.+\s)?fair|furniture (.+\s)?for (.+\s)?sale|furniture (.+\s)?liquidators|furniture (.+\s)?makers|furniture (.+\s)?manufacturers|furniture (.+\s)?mart|furniture (.+\s)?on (.+\s)?sale|furniture (.+\s)?online|furniture (.+\s)?outlet|furniture (.+\s)?outlet (.+\s)?stores|furniture (.+\s)?outlets|furniture (.+\s)?rental|furniture (.+\s)?repair|furniture (.+\s)?retailers|furniture (.+\s)?row|furniture (.+\s)?sale|furniture (.+\s)?sales|furniture (.+\s)?sets|furniture (.+\s)?shop|furniture (.+\s)?shops|furniture (.+\s)?showroom|furniture (.+\s)?store|furniture (.+\s)?stores|furniture (.+\s)?website|furniture (.+\s)?websites|furniture (.+\s)?wholesale|furniture (.+\s)?world|furniture's|furniture's (.+\s)?stores|futon|futons|gallery (.+\s)?furniture|garden (.+\s)?furniture|gazebo|gazebos|girls (.+\s)?bedroom (.+\s)?furniture|glass (.+\s)?dining (.+\s)?table|glass (.+\s)?dining (.+\s)?tables|hallway (.+\s)?table|hallway (.+\s)?tables|halogen (.+\s)?light|halogen (.+\s)?lights|hammock|hammocks|handle|handles|hanging (.+\s)?lamps|hanging (.+\s)?light (.+\s)?fixtures|hanging (.+\s)?lights|headboard|headboards|home (.+\s)?furnishing|home (.+\s)?furnishings|home (.+\s)?furniture|home (.+\s)?furniture (.+\s)?showroom|home (.+\s)?furniture (.+\s)?stores|home (.+\s)?lighting|home (.+\s)?office (.+\s)?furniture|hooker (.+\s)?furniture|hotel (.+\s)?furniture|house (.+\s)?furniture|house (.+\s)?lighting|hutch|hutches|indoor (.+\s)?lighting|inexpensive (.+\s)?furniture|interior (.+\s)?lighting|interior (.+\s)?lights|italian (.+\s)?furniture|italian (.+\s)?lighting|jordans (.+\s)?furniture|kids (.+\s)?bed|kids (.+\s)?bedroom (.+\s)?furniture|kids (.+\s)?beds|kids (.+\s)?furniture|kids (.+\s)?room (.+\s)?furniture|kincaid (.+\s)?furniture|king (.+\s)?bed|king (.+\s)?beds|king (.+\s)?size (.+\s)?bed|king (.+\s)?size (.+\s)?beds|kitchen|kitchen (.+\s)?cabinet|kitchen (.+\s)?cabinets|kitchen (.+\s)?ceiling (.+\s)?lights|kitchen (.+\s)?chair|kitchen (.+\s)?chairs|kitchen (.+\s)?faucet|kitchen (.+\s)?faucets|kitchen (.+\s)?island (.+\s)?lighting|kitchen (.+\s)?light|kitchen (.+\s)?light (.+\s)?fixture|kitchen (.+\s)?light (.+\s)?fixtures|kitchen (.+\s)?lighting|kitchen (.+\s)?lighting (.+\s)?fixture|kitchen (.+\s)?lighting (.+\s)?fixtures|kitchen (.+\s)?lights|kitchen (.+\s)?pendant (.+\s)?lighting|kitchen (.+\s)?sink|kitchen (.+\s)?sinks|kitchen (.+\s)?table|kitchen (.+\s)?tables|kitchen (.+\s)?track (.+\s)?lighting|kitchens|knob|knobs|lamp|lamp (.+\s)?lighting|lamp (.+\s)?shade|lamp (.+\s)?shades|lamp (.+\s)?store|lamps|lamps (.+\s)?and (.+\s)?lighting|lamps (.+\s)?online|lane (.+\s)?furniture|leather (.+\s)?chair|leather (.+\s)?chairs|leather (.+\s)?couch|leather (.+\s)?couches|leather (.+\s)?furniture|leather (.+\s)?recliner|leather (.+\s)?recliners|leather (.+\s)?sectional|leather (.+\s)?sectional (.+\s)?sofa|leather (.+\s)?sectional (.+\s)?sofas|leather (.+\s)?sectionals|leather (.+\s)?sofa|leather (.+\s)?sofas|led (.+\s)?home (.+\s)?lighting|led (.+\s)?light (.+\s)?fixtures|led (.+\s)?lighting|lexington (.+\s)?furniture|licing (.+\s)?room (.+\s)?chair|light (.+\s)?fitting|light (.+\s)?fittings|light (.+\s)?fixture|light (.+\s)?fixtures|light (.+\s)?lamp|light (.+\s)?store|lighting|lighting (.+\s)?companies|lighting (.+\s)?company|lighting (.+\s)?design|lighting (.+\s)?designer|lighting (.+\s)?fixture|lighting (.+\s)?fixtures|lighting (.+\s)?manufacturers|lighting (.+\s)?online|lighting (.+\s)?sale|lighting (.+\s)?shop|lighting (.+\s)?shops|lighting (.+\s)?store|lighting (.+\s)?stores|lighting (.+\s)?suppliers|lightings|lights|living (.+\s)?room|living (.+\s)?room (.+\s)?chairs|living (.+\s)?room (.+\s)?furniture|living (.+\s)?room (.+\s)?furniture (.+\s)?sale|living (.+\s)?room (.+\s)?furniture (.+\s)?sets|living (.+\s)?room (.+\s)?lighting|living (.+\s)?room (.+\s)?set|living (.+\s)?room (.+\s)?sets|living (.+\s)?room (.+\s)?sofa|living (.+\s)?rooms|local (.+\s)?furniture (.+\s)?stores|log (.+\s)?furniture|lounge (.+\s)?furniture|love (.+\s)?seat|love (.+\s)?seats|loveseat|loveseats|low (.+\s)?voltage (.+\s)?lighting|luxury (.+\s)?furniture|maple (.+\s)?furniture|metal (.+\s)?furniture|mirror|mirrored (.+\s)?furniture|mirrors|mission (.+\s)?furniture|mission (.+\s)?style (.+\s)?furniture|modern (.+\s)?bathroom (.+\s)?lighting|modern (.+\s)?bathroom (.+\s)?vanities|modern (.+\s)?bedroom (.+\s)?furniture|modern (.+\s)?chair|modern (.+\s)?chairs|modern (.+\s)?chandeliers|modern (.+\s)?contemporary (.+\s)?furniture|modern (.+\s)?dining (.+\s)?room (.+\s)?furniture|modern (.+\s)?dining (.+\s)?table|modern (.+\s)?furniture|modern (.+\s)?furniture (.+\s)?design|modern (.+\s)?furniture (.+\s)?stores|modern (.+\s)?kitchen|modern (.+\s)?lamp|modern (.+\s)?lamps|modern (.+\s)?light (.+\s)?fixtures|modern (.+\s)?lighting|modern (.+\s)?lighting (.+\s)?fixtures|modern (.+\s)?lights|modern (.+\s)?living (.+\s)?room (.+\s)?furniture|modern (.+\s)?office (.+\s)?furniture|modern (.+\s)?outdoor (.+\s)?furniture|modern (.+\s)?pendant (.+\s)?lighting|modern (.+\s)?sofa|modern (.+\s)?sofas|modular (.+\s)?furniture|modular (.+\s)?kitchen|monorail (.+\s)?lighting|nebraska (.+\s)?furniture (.+\s)?mart|new (.+\s)?furniture|nightstand|nightstands|north (.+\s)?carolina (.+\s)?furniture|nursery (.+\s)?furniture|oak (.+\s)?furniture|occasional (.+\s)?table|occasional (.+\s)?tables|office (.+\s)?chair|office (.+\s)?chairs|office (.+\s)?furniture|office (.+\s)?lighting|online (.+\s)?furniture|online (.+\s)?furniture (.+\s)?shopping|online (.+\s)?furniture (.+\s)?stores|online (.+\s)?lighting|oriental (.+\s)?furniture|ottoman|ottomans|outdoor (.+\s)?firepit|outdoor (.+\s)?firepits|outdoor (.+\s)?fire (.+\s)?pit|outdoor (.+\s)?fire (.+\s)?pits|outdoor (.+\s)?furniture|outdoor (.+\s)?kitchen|outdoor (.+\s)?kitchens|outdoor (.+\s)?lamp|outdoor (.+\s)?lamps|outdoor (.+\s)?light|outdoor (.+\s)?light (.+\s)?fixtures|outdoor (.+\s)?lighting|outdoor (.+\s)?lighting (.+\s)?fixtures|outdoor (.+\s)?lightning|outdoor (.+\s)?lightings|outdoor (.+\s)?lights|outdoor (.+\s)?wall (.+\s)?light|outdoor (.+\s)?wall (.+\s)?lighting|outdoor (.+\s)?wall (.+\s)?lights|outdoor (.+\s)?wicker (.+\s)?furniture|outside (.+\s)?lighting|outside (.+\s)?lights|painted (.+\s)?furniture|patio (.+\s)?furniture|patio (.+\s)?furniture (.+\s)?cover|patio (.+\s)?furniture (.+\s)?covers|patio (.+\s)?set|patio (.+\s)?sets|pendant (.+\s)?lamp|pendant (.+\s)?lamps|pendant (.+\s)?light|pendant (.+\s)?light (.+\s)?fixtures|pendant (.+\s)?lighting|pendant (.+\s)?lights|pillow|pillows|pine (.+\s)?furniture|planter|planters|porch (.+\s)?lights|porch (.+\s)?swing|porch (.+\s)?swings|pulaski (.+\s)?furniture|quality (.+\s)?furniture|queen (.+\s)?bed|queen (.+\s)?beds|rattan (.+\s)?furniture|recessed (.+\s)?light|recessed (.+\s)?lighting|recessed (.+\s)?lights|recliner|recliner (.+\s)?chair|recliner (.+\s)?chairs|recliners|residential (.+\s)?lighting|restaurant (.+\s)?furniture|restaurant (.+\s)?lighting|retro (.+\s)?furniture|riverside (.+\s)?furniture|rocking (.+\s)?chair|rocking (.+\s)?chairs|room (.+\s)?furniture|round (.+\s)?dining (.+\s)?table|rug|rugs|rustic (.+\s)?furniture|rustic (.+\s)?lighting|sauder (.+\s)?furniture|scandinavian (.+\s)?furniture|school (.+\s)?furniture|sconce|sconce (.+\s)?lighting|sconces|second (.+\s)?hand (.+\s)?furniture|sectional|sectional (.+\s)?couch|sectional (.+\s)?couches|sectional (.+\s)?furniture|sectional (.+\s)?sofa|sectional (.+\s)?sofas|sectionals|shabby (.+\s)?chic (.+\s)?furniture|shaker (.+\s)?furniture|shoerack|shoeracks|shoe (.+\s)?rack|shoe (.+\s)?racks|shop (.+\s)?furniture|shop (.+\s)?lighting|shower|showers|sideboards|single (.+\s)?bed|single (.+\s)?beds|singles (.+\s)?bed|singles (.+\s)?beds|sink|sinks|sleeper (.+\s)?sofa|sleeper (.+\s)?sofas|small (.+\s)?bathroom (.+\s)?vanities|small (.+\s)?kitchen (.+\s)?design|small (.+\s)?kitchen (.+\s)?ideas|sofa|sofa (.+\s)?bed|sofa (.+\s)?beds|sofa (.+\s)?furniture|sofa (.+\s)?sale|sofa (.+\s)?sales|sofa (.+\s)?set|sofa (.+\s)?sets|sofa (.+\s)?store|sofa (.+\s)?stores|sofa (.+\s)?table|sofa (.+\s)?tables|sofas|solid (.+\s)?wood (.+\s)?furniture|star (.+\s)?furniture|stool|stools|table|table (.+\s)?lamp|table (.+\s)?lamps|tables|tall (.+\s)?bathroom (.+\s)?cabinets|teak (.+\s)?furniture|teak (.+\s)?outdoor (.+\s)?furniture|the (.+\s)?furniture (.+\s)?store|the (.+\s)?lighting (.+\s)?company|thomasville (.+\s)?furniture|toilet|toilet (.+\s)?design|toilet (.+\s)?designs|toilets|track (.+\s)?light|track (.+\s)?lighting|track (.+\s)?lighting (.+\s)?fixtures|track (.+\s)?lights|traditional (.+\s)?furniture|tv (.+\s)?furniture|unfinished (.+\s)?furniture|unfinished (.+\s)?wood (.+\s)?furniture|unique (.+\s)?furniture|upholstered (.+\s)?furniture|used (.+\s)?furniture|used (.+\s)?office (.+\s)?furniture|vanities|vanity|vanity (.+\s)?lighting|vase|vases|victorian (.+\s)?furniture|vintage (.+\s)?furniture|wall (.+\s)?lamp|wall (.+\s)?lamps|wall (.+\s)?light|wall (.+\s)?light (.+\s)?fixtures|wall (.+\s)?lighting|wall (.+\s)?lights|wall (.+\s)?sconce|wall (.+\s)?sconce (.+\s)?lighting|wall (.+\s)?sconces|wall (.+\s)?shelf|wall (.+\s)?shelves|waste (.+\s)?basket|waste (.+\s)?baskets|white (.+\s)?bathroom (.+\s)?vanities|white (.+\s)?bedroom (.+\s)?furniture|white (.+\s)?furniture|wholesale (.+\s)?furniture|wholesale (.+\s)?lighting|wicker (.+\s)?furniture|wickes (.+\s)?furniture|wine (.+\s)?rack|wine (.+\s)?racks|wood (.+\s)?furniture|wooden (.+\s)?furniture|wrought (.+\s)?iron (.+\s)?chandeliers|wrought (.+\s)?iron (.+\s)?furniture)\b/gim;
                brandsInSearch = searchTxt.match(pipBrandInDomain);
            }

            if (brandsInSearch !== null && brandsInSearch.length) {
                var brandInDomain = brandsInSearch.join(' | ')

                if(!similarproducts.b.LTDGoogleImageMatchedBrand || similarproducts.b.LTDGoogleImageMatchedBrand !== brandInDomain){

                    similarproducts.sfdebugger.log('isLTDPip found : ' + brandInDomain);
                    similarproducts.b.LTDGoogleImageMatchedBrand = brandInDomain;

                    var LTDPipReportAction = [];
                    LTDPipReportAction.push('action=LTDGoogleImg');
                    LTDPipReportAction.push('page_url=' + encodeURIComponent(document.location.href));
                    LTDPipReportAction.push('matchedbrand=' + brandInDomain);
                    LTDPipReportAction.push('dlsource=' + similarproducts.b.dlsource);
                    LTDPipReportAction.push('userid=' + spsupport.p.userid);
                    LTDPipReportAction.push('browser=' + spsupport.api.dtBr());
                    LTDPipReportAction.push('merchantName=' + spsupport.p.siteDomain);
                    LTDPipReportAction.push('country=' + similarproducts.b.userData.uc);

                    var reportParamsString = LTDPipReportAction.join('&');
                    reportParamsString += similarproducts.utilities.abTestUtil && similarproducts.utilities.abTestUtil.getDataString() || '';

                    var LTDPipImgSrc = similarproducts.b.pluginDomain + 'trackSession.action?' + reportParamsString;

                    var LTDPipImg = new Image();
                    LTDPipImg.src = LTDPipImgSrc;
                }

                spsupport.sites._google.numOfImages = spsupport.p.$('img:[src]').length;
                spsupport.p.$(window).scroll(function (event) {
                    if(spsupport.sites._google.numOfImages < spsupport.p.$('img:[src]').length){
                       spsupport.sites._google.numOfImages = spsupport.p.$('img:[src]').length;
                       spsupport.api.startDOMEnumeration();
                    }
                });
                return 1;
            } else {
                return 0;
            }
        },

        isImagesSearch: function() {
            var iu = spsupport.sites.inURL;
            if (iu("tbm=isch")) {
                return 1;
            } else {
                return 0;
            }
        },

        validRefState : function(){
            var iu = spsupport.sites.inURL;
            // match query for supported google pages

            return  ( 
                spsupport.p.$(this.vQ).length
                || iu("tbs=shop")
                || iu("tbm=shop")
                || iu("products/catalog" )
                || iu("books.google" )
                || iu("tbm=bks")
                || iu("tbs=bks")
                || iu("tbm=isch")
                || iu("google.com/shopping")
                );
        },

        preInject : function(){
            var iu = spsupport.sites.inURL;
            var sIU = spsupport.p.supportedImageURLs;
            if ( sIU ){
                sIU[sIU.length] = "jpg;base64";
                sIU[sIU.length] = "jpeg;base64";
                sIU[sIU.length] = "gstatic.com";
            }
            else{
                sIU = ["jpg;base64", "jpeg;base64", "gstatic.com"];
            }
            if(iu("books.google")){
                var wN = spsupport.p.$('div[id *= "_sliders"]');
                if(wN.length){
                    wN.each(function() {
                        spsupport.domHelper.addEListener(this, spsupport.api.onDOMSubtreeModified, "DOMSubtreeModified");
                    });
                }
            }
        },

        validProdImg : function(){
            if( spsupport.p.$( this.vQ ).length && !this.prodImg ){
                this.prodImg = 1;
                return 1;
            }
            return 0;
        },

        imgSupported : function( im ){
            if( im.id && im.id.indexOf("vidthumb")> -1 ||
                im.className.indexOf("vidthumb") > -1 ||
                im.className.indexOf("imgthumb") > -1 ){
                return 0;
            }
            return 1;
        },

        getRelText : function(node){
            if (node) {
                var spa = spsupport.api;
                var lNode = spa.getLinkNode(node, 3);
                if (lNode) {
                    var url = lNode.href;
                    var pUrl = "";
                    if( url.indexOf( "javascript" ) == -1 ){
                        if( url.indexOf("http://www.google.com/url?") > -1 ){
                            var pSign = url.indexOf("=");
                            if( pSign > -1 ){
                                url = url.substr( pSign + 1, url.length );
                            }
                        }
                        try{
                            url = decodeURIComponent( url );
                        }catch(e){
                        // not encoded
                        }
                        var prm = url.indexOf("&");
                        if( prm > -1 ){
                            url = pUrl = url.substr(0, prm);
                        }
                        var sec = node;
                        var cl = 0;
                        for (var i = 0; i < 20; i++) {
                            sec = sec.parentNode; 
                            if (sec && sec.getAttribute) {
                                cl = sec.getAttribute('class');
                                if (cl && cl.indexOf('knavi') > -1 || sec.nodeName == 'body') {
                                    break;
                                }
                            }
                            else { 
                                break; 
                            }
                        }
                        var txt = '';
                        if (!txt) {
                            txt = this.moreRelText(lNode);
                        }
                    }
                    return({
                        prodUrl : ( pUrl != "" ? pUrl : lNode.href ),
                        iText : txt
                    });
                }
            }
            return 0;
        },
        
        moreRelText: function(lNode) {
            var txt = '';
            if (lNode) {
                var parent = lNode.parentNode;
                for (var i = 0; i < 4; i++) {
                    if (parent) {
                        var a = spsupport.p.$('a', spsupport.p.$(parent));
                        txt = a.text();
                        if (txt) {
                            break;
                        }
                        else {
                            parent = parent.parentNode;
                        }
                    }
                }
            }
            if (txt.length > 70) {
                txt = txt.substring(0, 69);
            }
            return txt;
        },
        
        su : function(){
            return 1;
        }
    },
    
    _macys : {
        care : function(){
            setTimeout( function(){
                spsupport.sites._macys.paging();
            }, 1000 );
        },

        urlChange : function(){
            if( !spsupport.sites._macys.evtc ){
                spsupport.api.killIcons();
                setTimeout( function(){
                    spsupport.p.prodPage.reset();
                    spsupport.p.SRP.reset();
                    spsupport.api.startDOMEnumeration();
                }, 1700 );
                setTimeout( function(){
                    spsupport.api.wRefresh( 300 );
                }, 2700 );
                setTimeout( function(){
                    spsupport.sites._macys.paging();
                }, 3500 );
            }
        },
        
        paging : function(){
            var pgn = spsupport.p.$('.paginationSpacer');
            if(pgn.length){
                setTimeout(function(){
                    pgn.each(                            
                        function() {
                            var tDel = 1500;
                            spsupport.p.$(this).on('mouseup', function(){
                                spsupport.api.killIcons();
                                spsupport.sites._macys.evtc = 1;
                                setTimeout( function(){
                                    spsupport.api.startDOMEnumeration();
                                }, tDel );
                                setTimeout( function(){
                                    spsupport.api.wRefresh( tDel / 3 );
                                },  tDel * 2 );
                                setTimeout( function(){
                                    spsupport.sites._macys.paging();
                                }, tDel * 2.5 );
                            });
                        });
                }, 1400);
                this.evtc = 0;
            }
        }
    },
    
    _bing : {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },
        
        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
           if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('bing');
            }
        }
    },

    _snapdo : {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },
        
        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
            var ssg = similarproducts.sg;

            if ( similarproducts.b.searchget && ssg ) {
               ssg.isSearchSearchget = true ;
               spsupport.txtSr.searchget('snapdo');
            }
        }
    },
            
    _cloudapp: {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },
        
        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
            if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('cloudapp');
            }
        }
    },

    _yahoo : {
        vImgURL : function( u ){
            var uD = u.split( "http" );
            if( uD.length > 2 ){
                uD = uD[ 2 ];
            }else if( uD.length == 2){
                uD = uD[ 1 ];
            }else{
                uD = uD[ 0 ];
            }
            uD = uD.split( "&" );
            uD = uD[ 0 ];
            return "http" + uD;
        },
        
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },
        
        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function()
        {
            var ssg = similarproducts.sg;

	        if ( similarproducts.b.searchget && ssg && spsupport.txtSr )
	        {
                ssg.isSearchSearchget = true ;
		        ssg.cssStore = 'display:block; font-size:11px; color:#1E7D83; text-decoration none; width:90px; overflow:hidden; text-overflow:ellipsis; line-height:15px;';
	            spsupport.txtSr.searchget('yahoo');
            }
        },

	    gVI : function ()
	    {
            return [];
        },

	    txtSrch: function() {
            if (spsupport.txtSr) {
                spsupport.txtSr.useWl();
            }
        },

        validProdImg : function(){
            return 1;
        },

	    su : function(){
            return 1;
        }
    },

    _amazon : {        
        intVal: 0,
        activePop:0,

	    getZIndex: function () {
		    return 90;
	    },
                
        isBlackStage: function() {
            if (similarproducts.b && similarproducts.b.disableAmazonIE && similarproducts.p.isIE) {
                return true;
            }
            return false;
        },                

	    inimg: function(inimgObject)
	    {
		    inimgObject.view.self.css({zIndex: 91});
	    },

	    searchget: function() {
            var ssg = similarproducts.sg;

            if (ssg && similarproducts.b.merchantSearchget)
            {
	            ssg.q = '#buyboxDivId';
                ssg.q = '#buybox';

	            if(spsupport.p.$(ssg.q).length )
                {
	                ssg.sSite = 3;
                    ssg.relpos = 'insertBefore';
                    ssg.lines = 2;
                    ssg.powered1 = 'by&nbsp;';
                    var st = 'font-size:11px;font-family: Arial,sans-serif;';
                    ssg.cssMainTitle = 'color:#000000;' + st ;
                    ssg.cssPowered = 'text-align:right;color:#009900;' + st;
                    ssg.cssTitle = 'display:block;padding-top: 3px;font-size:11px;overflow: hidden; max-height:30px;';
                    ssg.cssPrice = 'padding-top: 2px;font-size:11px;';
                    ssg.cssStore = 'display:block;font-size:11px;height:14px; overflow: hidden;color:#0E774A;';
                    ssg.cookie = '_amazon';
                    spsupport.sites.sgGen();
                }
                else {
                    ssg.sSite = 0;
                }

//	            if (spsupport.p.dlsource == "conduit" || spsupport.p.dlsource == "conduit2" || spsupport.p.dlsource == "conduit3") {
//                    ssg.sSite = 0;
//                }
            }
        },
        
        care : function(){
            var storedSearch = window.location.search;
            t = this;
            this.intVal = window.setInterval(function () {
                if (window.location.search != storedSearch) {
                    storedSearch = window.location.search;
                    spsupport.sites.onUrlChange();
                }
            }, 2000);

            if (!similarproducts.b.amazon) {
                similarproducts.b.inimgSrp = 0;
                similarproducts.b.inimg = 0;
                //similarproducts.b.icons = 0;
            }
	        else
            {
	            spsupport.p.sgDualResults = true;
            }
            
            if (similarproducts.b.amazonNoIcons) {
                similarproducts.b.icons = 0;
            }

            spsupport.p.$("#holderMainImage, #image-block-widget,#main-image-canvas").click(function(){
                spsupport.p.$("#similarproducts_inimg").css("z-index",998);
                spsupport.p.$("#sf_see_similar").css("z-index",998);
                t.activePop = 1;
                window.setTimeout("spsupport.sites._amazon.activePopup()",1000);
            });
        },

        activePopup:function(){
            if(spsupport.p.$("div#ap_overlay").length>0){ // then the big overlay is open
                this.activePop = window.setTimeout("spsupport.sites._amazon.activePopup()",1000);
            }else{
                this.disableActivePopup();
            }
        },

        disableActivePopup: function(){
            window.clearTimeout(this.activePop);
            this.activePop = null;
            spsupport.p.$("#similarproducts_inimg").css("z-index",12010);
            spsupport.p.$("#sf_see_similar").css("z-index",12005);
        },

        offInt: function() {
            if(this.intVal){
              window.clearInterval(this.intVal);
              this.intVal = 0;
          }
        },        

        gRD : function(){
            return 1300;
        }
    },
    
    _similarproducts: {

        getRelText : function(node){
            var parent = node; 
            var jParent;
            var txt = '';
            for (var i = 0; i < 20; i++) {
                if (parent) {
                    jParent = spsupport.p.$(parent);
                    if (jParent.hasClass('item')) {
                        txt = jParent.text();
                        break;
                    }
                    parent = parent.parentNode;
                }
            }

            return {
                prodUrl: '',
                iText: txt                                        
            };
        },        

        su: function () {
            return 10;
        }        
    },
    
    _searchcompletion: {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
            if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('searchcompletion');
            }
        }
    },

    _widdit: {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
            if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('searchcompletion');
            }
        }        
    },
    
    _autocompletepro: {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
           if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('searchcompletion');
            }
        }        
    },
    
    _protectedsearch: {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
           if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('searchcompletion');
            }
        }        
    },

    _certified_toolbar: {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
           if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('searchcompletion');
            }
        }        
    },

    _adfuse: {  //brandthunder
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
	       if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('brandthunder');
            }
        }        
    },
	_brandthunder: {  //brandthunder
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
	        if ( similarproducts.b.merchantSearchget ) {
                spsupport.txtSr.searchget('brandthunder');
            }
        }
    },
            
	_findwide: {
        care: function(){
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
	      var ssg = similarproducts.sg;

          if ( similarproducts.b.searchget && ssg ) {
                ssg.isSearchSearchget = true ;
                spsupport.txtSr.searchget('findwide');
          }
        }
    },            
    
    _surfcanyon: {
        care: function(){            
            if (spsupport.txtSr) {
                spsupport.txtSr.disableAll();
            }
        },
        
        firstTimeRep: function(){
            spsupport.events.reportEvent("in surfcanyon care", "info");
            spsupport.statsREP.reportStats(spsupport.statsREP.repMode.CPM);
        },

        ph2bi : function(){
            return spsupport.txtSr ? spsupport.txtSr.ph2bi() : 0;
        },

        searchget: function() {
           var ssg = similarproducts.sg;

            if ( similarproducts.b.searchget && ssg ) {
               ssg.isSearchSearchget = true ;
               spsupport.txtSr.searchget('surfcanyon');
            }
        }        
    },

    _ebay: {

   	    getZIndex: function () {
		    return 120;
	    },
                
		inimg: function(inimgObject)
		{
			inimgObject.view.self.css({zIndex: 130});
		},
                

        care : function(){
            spsupport.p.prodPage.d = 149;
            spsupport.p.prodPage.l = 1500; 
            spsupport.p.sgDualResults = true;
            // similarproducts.b.inimgSrp = 0;
        },

        searchget: function() {
            spsupport.p.prodPage.d = 149;
            spsupport.p.prodPage.l = 1500;           
            var vQ = '#vi-tTblC2 > div, #RightSummaryPanel > div, #AdPanel, #BuyingOptions3, #viewad-sidebar'; //#BuyOptionsWrapper';//.si-trs-top'; // default (us)
            vQ += ', #isclmn + td > div'; // .de, .fr, .co.uk

            var ssg = similarproducts.sg;

            if (ssg && similarproducts.b.merchantSearchget) {
                if(spsupport.p.$(vQ).length) {
                    similarproducts.b.sgAllenby = 0;
                    ssg.sSite = 3;
                    ssg.q = vQ;
                    ssg.powered1 = 'by&nbsp;';
                    var st = 'font-size:11px;font-family: Arial,sans-serif;';
                    ssg.cssMain = 'margin-bottom:39px; margin-top:-25px;';
                    ssg.cssMainTitle = 'color:#000000;' + st ;
                    ssg.cssPowered = 'text-align:right;color:#0E774A;' + st;
                    ssg.relpos = 'insertBefore';
                    ssg.itemWidth = 92;
                    ssg.cssTitle = 'color:#002398;display:block;padding-top:3px;font-size:11px;overflow: hidden; max-height:30px;';
                    ssg.cssPrice = 'padding-top: 2px;font-size:11px;';
                    ssg.cssStore = 'display:block;font-size:11px;height:14px; overflow: hidden;color:#0E774A;';
                    ssg.cookie = '_ebay';
                    spsupport.sites.sgGen();
                }
                else {
                    ssg.sSite = 0;
                }
                
//                if (spsupport.p.dlsource == "conduit" || spsupport.p.dlsource == "conduit2" || spsupport.p.dlsource == "conduit3") {
//                    ssg.sSite = 0;
//                }
                
            }
        },
        
        isSrp: function() {
            var iu = spsupport.sites.inURL;
            if (iu('/sch/') || iu('deals.ebay') || iu('_nkw=')) {
                spsupport.p.pageType = 'SRP';
                return 1;
            }
            return 0;
        },
                
        imgSupported : function(im){
            if( im.src &&
                (im.src.indexOf("SPRO_Seller_C2C_ZIZAuction-0915-v2_Q313")> -1) ||
                (im.src.indexOf("rtm.ebaystatic")> -1)){
                return 0;
            }
            return 1;
        },
                
        imgValidForInimg : function(img){
	        if (!img) {
                return 0;
            }
            var centerPanel = spsupport.p.$('#CenterPanel');
            var parent = img.parentNode;
            if (spsupport.p.pageType == 'SRP') {
                if(centerPanel && centerPanel.length) {
                    for(var i = 0; i < 100; i++) {
                        if (parent == centerPanel[0]) {
                            return 1;
                        }
                        if (parent == spsupport.p.$('body')[0]) {
                            return 0;
                        }
                        parent = parent.parentNode;
                    }
                    return 1;
                }
                else {
                    return 1;
                }
            }
            else {
                return 1;
            }
        },
        
        su: function () {return 10;},
        
        fCn: function(nd, ccl) {   // find containing node (card of the product on SRP)
            var atCl = '';
            while (nd && nd.nodeName.toLowerCase() != 'body') {
                nd = nd.parentNode;
                atCl = nd.getAttribute('class');
                if (atCl && atCl.indexOf(ccl) > -1) {
                    return nd;
                }
            }
            return 0;
        },
        
        fTx: function(nd, cl) {    // fetch text. nd - node, ccl - class of container, cl - class of wanted node
            var iT = '';
            if (nd) {
                nd = cl ? spsupport.p.$('.' + cl, nd)[0] : nd;
                if (nd) {
                    iT = spsupport.api.getTextOfChildNodes(nd);
                }
            }
            return iT;

        },

        getRelText : function(node){
            if (node) {
                var relTxt = {
                    prodUrl: "",
                    iTitle: "",        
                    iText: ""
                };                
                var spa = spsupport.api;
                var lNode = spa.getLinkNode(node, 5);
                var nd;
                relTxt.prodUrl = lNode ? lNode.href : '';
                relTxt.prodUrl = relTxt.prodUrl.indexOf('javascript:') > -1 ? '' : relTxt.prodUrl;
                relTxt.iTitle = lNode ? lNode.getAttribute("title") : "";
                var srp = document.location.href.indexOf('/sch/') > -1 ? 1 : 0; 
                if( srp && document.location.href.indexOf('&_dmd=1') > 10 ){    // eBay SRP, list view
                    node = this.fCn(node, 'card');
                    relTxt.iText = this.fTx(node, 'rslp-cd');                    
                }
                else if (srp && document.location.href.indexOf('&_dmd=2') > 10) {   // eBay SRP, table view
                    node = this.fCn(node, 'card');
                    if (!relTxt.prodUrl.length) {
                        nd = spsupport.p.$('.title a', node)[0];
                        if (!nd) {
                            nd = spsupport.p.$('a.ittl', node)[0];
                        }
                        relTxt.iText = nd ? this.fTx(nd) : this.fTx(node);
                        relTxt.prodUrl = nd ? nd.href : '';
                    }
                    else {
                        relTxt.iText = this.fTx(node);
                    }
                }
                else if (srp && document.location.href.indexOf('&_dmd=5') > 10) {   // eBay SRP, 2 halves view
                    node = this.fCn(node, 'tri-i');
                    relTxt.iText = this.fTx(node, 'ittl');
                    if (!relTxt.prodUrl.length) {
                        nd = spsupport.p.$('a.ittl', node)[0];
                        relTxt.prodUrl = nd ? nd.href : '';
                    }
                }
                else if (document.location.href.indexOf('/itm/') > -1 || document.location.href.indexOf('/ctg/') > -1) { // vi-ih-bc-label
                    if (!lNode) {
                        nd = spsupport.p.$('h1');
                        relTxt.iText = spsupport.api.getTextOfChildNodes(nd[0]);
                    }
                }
                if ((!relTxt.iText || !relTxt.iText.length) && lNode) {
                    relTxt.iText = spsupport.api.textFromLink(lNode.href);
                }
                return relTxt;
            }
            return 0;
        }

    }
};

        
            spsupport.txtSr = {
    wl: {},
    sent: 0,
    ext: '',
    del: '***',
    txts: [],
    txtsWl: [],
    searchgetReport: [],
    sentSearchgetReport: 1,
    SearchgetResult: 0,
    reason: 0,
    t: '', // additional texts
    data: {
        'surfcanyon': {
            mn: 'Surfcanyon',
            q: '#resultTable tr:not([id])', // Result item after which serchget will be injected
            wrapper: '<tr><td class="position"></td><td>',
            wrappperClose: '</td></tr>',
            inp: '#searchbox_textfield', // The search query input
            link: '.search-result .url',  // Result item source name (site name)
	        txt: '.search-result .activeLink' // Result item link
        },
        'searchcompletion' : {
            mn: 'Searchcompletion',
            q: '#SF_TARGET',
            cssMain: 'padding-left: 12px;',
            inp: '#sbi',
            relpos: 'appendTo',
            container: '#SF_TARGET',
            link: '.results cite'
        },
        'widdit': {
            mn: 'Searchcompletion'
        },
        'autocompletepro': {
            mn: 'Searchcompletion'
        },
        'protectedsearch': {
            mn: 'Searchcompletion'
        },
        'certified-toolbar': {
            mn: 'Searchcompletion'
        }, 
        'brandthunder' : {
            mn: 'Brandthunder',
            q: '.result.resultFirst',
            inp: '#id_q',
            txt: '.resultTitle-is a',
            link: '.resultPath a'
        },
        'bing': {
            mn: 'Bingtext',
            q: 'ul#wg0 li', //'#results .super',
            inp: '#sb_form_q',
            wrapper: '<li class="sa_wr">',
            wrappperClose: '</li>',
            num: 5,
            txt: '.sb_tlst a',
            link: '.sb_meta cite'
        },        
        'yahoo': {
            mn: 'Yahootext',
	        pwrd: true,
            //q: 'ul.spns li, #web ol li', //'#results .super',
            q: '#web ol li', //'#results .super',
	        wrapper: '<li>',
	        wrappperClose: '</li>',
	        relpos: 'insertBefore',
            inp: '#yschsp',
            num: 7,
            link: '.url,',
	        txt: '.yschttl, .abstr'
        },        
        'google': {
            sendLate: 1,
            mn: 'Googletext',
            q: '#rso li',
            inp: '#gbqfq, #lst-ib',
            //txt: 'li.g a.l, li.g h3.r',
            txt: 'li.g div.rc h3.r',
            link: 'li.g .f cite'
        },
        'snapdo': {
            mn: 'Snapdo',
            q: '#SearchResults .search-result',
	        /*container: '#SearchResults .search-result',
	        wrapper: '<div style="">',
	        wrappperClose: '</div>',*/
            relpos: 'insertBefore',
            inp: '#q',
            link: '#SearchResults .displayUrl',
	        txt: '#SearchResults .result-title',

	        customBehavior: function()
	        {
		        var $ = spsupport.p.$;
		        var self = $('#SF_SEARCHGET');
		        var items = $('.sgItem', self);
		        var itemWidth = $(items[0]).outerWidth(true);
		        var currentPossibleItems = items.length;

		        function calculateITems()
		        {
			        var selfWidth = self.width() || 102;
			        var possibleItems = Math.floor(selfWidth/itemWidth);

			        if (currentPossibleItems !== possibleItems)
			        {
				        for (var i=0, l=items.length; i<l; i++)
				        {
					        items[i].style.display = (i < possibleItems) ? 'block' : 'none';
				        }

				        currentPossibleItems = possibleItems;
			        }
		        }

		        $(window).resize(calculateITems)
	        }
        },
        'cloudapp': {
            mn: 'Cloudapp',
            q: '#SearchResults .search-result',
            relpos: 'insertBefore',
            inp: '#q',
            link: '#SearchResults .displayUrl',
	        txt: '#SearchResults .result-title'
        },
        'craigslist': {
            sendLate: 1,
            mn: 'Craigslist',
            q: '#trFor0',
            txt: 'h2'
        },
        'findwide': {
            mn: 'Findwide',
            q: 'ul.col2ul li',
            relpos: 'insertBefore',
            inp: '#search_keyword', 
            link: 'ul.colads li cite',  
	        txt: 'ul.colads li h3' 
        }        
    },
     
    jAnc: [],
    
    siteInfo: function(domain) {
        var d = domain.split('.')[0];
        var sS = 0;
        if (this.data[d]) {
            sS = {
                imageURLPrefixes: '',
                merchantName: domain
            };
        }
        return sS;
    },
    
    ph2bi : function(){
        if(this.jAnc.length) {
            return 1;
        }
        return 0;
    },
    
    gu: function(str) {         // get url by google green string
        var s = str.split('›');
        return s[0];
    },
    
    disableAll: function() {
        var sfb = similarproducts.b;
        sfb.icons = 0;
        sfb.inimg = 0;
        sfb.inimgSrp = 0;
        sfb.cpn[0] = 0;
    },
    
    searchget: function(d) {
        var ssg = similarproducts.sg;
        this.dt = this.data[d];

	    if (ssg) {
	        ssg.offset = 1;
            ssg.itemWidth = 94;
            ssg.cssMain = this.dt.cssMain ? this.dt.cssMain : '';
            ssg.cssTitle = 'display:block; padding-top:3px; max-height:45px; margin-bottom:1px; overflow:hidden;';
            ssg.cssPrice = 'font-weight: bold;';
            ssg.cssStore = ssg.cssStore || 'display:block; color:green;text-decoration: none; width: 90px; overflow: hidden;line-height:15px;';
            ssg.cssPrompt = 'top: 20px; right: -37px;';
            ssg.q = this.dt.q;
            if (this.dt.relpos) {
                ssg.relpos = this.dt.relpos;
            }
            ssg.pwrd = this.dt.pwrd || 0;
            ssg.container = this.dt.container || 0;
            ssg.wrapper = this.dt.wrapper ? this.dt.wrapper : '';
            ssg.wrapperClose = this.dt.wrapperClose ? this.dt.wrapperClose : '';
            ssg.customBehavior = this.dt.customBehavior;

            ssg.cookie = '_' + d;                 
            if (spsupport.p.$(ssg.q).length)
            {
	            ssg.sSite = this.dt.num || 8;
            }
            this.jAnc = spsupport.p.$(ssg.q);

            spsupport.sites.sgGen();
        }
    }, 
    
    useWl: function(isException) {
        var txts = this.getTxts(); // string with del
        var inp = spsupport.p.$(this.dt.inp);
        var term = inp.attr('value');
        var jSpell = spsupport.p.$('a.spell');
        if (jSpell.length) {
            term = jSpell.text() || term;
        }
        if(isException)
            term = txts;

        this.searchgetReport = [];

        if(txts){
            this.searchgetReport.push("texts are - " + encodeURIComponent(txts));
        }else {
            this.searchgetReport.push("NO texts");
        }

        if(term)  {
            this.searchgetReport.push("term is - " + encodeURIComponent(term));
        } else {
            this.searchgetReport.push("NO term");
        }

        var txtsArr = txts.split(this.del);

        if (this.dt && this.jAnc.length && (this.toSend(txtsArr) || this.checkPip(txtsArr, term))) {
	        this.sg(txtsArr, term);
        }
	    else
        {
	        similarproducts.b.slideup2searchget && similarproducts.slideup2.hideSelf();
        }

        var searchgetReportImg = new Image();
        var rndSearchgetReport = Math.floor(Math.random() * 10000);
        if(this.sentSearchgetReport && rndSearchgetReport == 1){
            searchgetReportImg.src = spsupport.p.sfDomain+spsupport.p.sessRepAct+'?action=searchgetReport&page_url=' + encodeURIComponent(window.location.href) + '&source_id='+this.reason+'&dscr=' + this.searchgetReport.join('==>');
            this.sentSearchgetReport = 0;
        }
        //console.log(this.searchgetReport.join('==>'));

    },

    getTxts: function() {
        var tx = '';
        if (this.dt && this.dt.txt) {
            var jTx = spsupport.p.$(this.dt.txt);
            var del = this.del;
            var len = Math.min(jTx.length, 7);
            jTx.each(function(ind) {
                var tx1 = spsupport.p.$(this).text();
                tx1 = spsupport.p.$.trim(tx1);
                var matched = null;
                matched = tx1.match(/twitter|wikipedia|youtube/ig);
                if (ind < len && matched == null) {// tx1.toLowerCase().indexOf('twitter') == -1) {
                    tx += tx1 + del;
                }
            });
        }
        return tx;
    },
    
    setPip: function(mBr, valReason) {
        var ws = spsupport.whiteStage;
        ws.pip = 1; 
        ws.validReason = ws.validReason || valReason;
        mBr = ws.arrUn(mBr);
        ws.matchedBrand =  mBr.join(" | ").replace(" | undefined","");
        spsupport.p.siteType = 'pip';
    },
    
    checkPip: function(txtsArr, term) {
        this.searchgetReport.push("****** in checkPip");
        this.txts = [];
        var ws = spsupport.whiteStage;
        if (similarproducts.b.pipBrandInDomain && ws) {
            var pipBrandInDomain = "\\b"+ similarproducts.b.pipBrandInDomain.replace(/\s*\|[\s\|]*(\S\s*\|+)?/g,"\\b|\\b") + "\\b";
            var rBrands = new RegExp(pipBrandInDomain, 'gi');
            var reason = '';
            var mBr = [], cmBr = [];
            if (txtsArr) {
                for (var i = 0; i < txtsArr.length; i++) { 
                    mBr = txtsArr[i].match(rBrands);
                    if (mBr != null && mBr.length > 0 ){
                        cmBr = cmBr.concat(mBr);
                        this.txts[this.txts.length] = txtsArr[i];
                        if (this.texts && this.texts.length == 3) {
                            break;
                        }
                    }                    
                }
            }
            
            if (this.txts.length) {
                reason = 'brands in texts';
                this.searchgetReport.push("found the brands in " + this.txts.join('|'));
            }  else {
                this.searchgetReport.push("NO brands in texts ");
            }
            
            if (term) {
                mBr = term.match(rBrands);
                if (mBr != null && mBr.length > 0 ){
                    cmBr = cmBr.concat(mBr);
                    reason += ' | brand in term';
                    this.searchgetReport.push("brands in term ");
                } else {
                    this.searchgetReport.push("NO brands in term ");
                }
            }
            
            cmBr = ws.arrUn(cmBr);
            
            if (this.txts.length) {
                this.reason = 1;
                this.setPip(cmBr, reason);
                this.searchgetReport.push("********* Detect PIP");
                return 1;
            }
        }
        this.searchgetReport.push("********  PIP NOT Detected");
        return 0;
    },
        
    addTxts: function(mBr, txts) {
        var a = txts.split(this.del);
        var len = Math.min(a.length, 8);
        var t = [];
        for (var i = 0; i< mBr.length; i++) {
            for (var j = 3; j < len; j++) {
                if(a[j].indexOf(mBr[i]) > -1) {
                    t[t.length] = a[j];
                }
            }            
        }
        if (spsupport.whiteStage) {
            t = spsupport.whiteStage.arrUn(t);
        }
        t = t.join(" | ");
        this.t = t.substring(0, 250);        
    },
    
    toSend: function(texts)
    {
        this.searchgetReport.push("in toSend (WL)");
	    this.txts = [];
	    var urls = spsupport.p.$(this.dt.link);
	    var urlRegex = /^(?:https?:\/\/)?(.+?)(?:\/|#|\?|$|\s)/i;
	    var discardRegex = /^(google|yahoo)/;
	    var domain, limit = 0;
        var matched = 0;

	    for (var i=0, l = urls.length; i<l && limit<7; i++)
	    {
		    domain = spsupport.p.$(urls[i]).text();
            domain = spsupport.p.$.trim(domain);
		    matched = domain.match(urlRegex);
            if (matched && matched.length) {
                domain = matched[1] || matched[0];
            }
            else {
                domain = '';
            }          
		    domain = similarproducts.utilities.extractDomainName(domain);

            if (domain && texts[i] && !discardRegex.test(domain) && this.wl.supportedSitesMap[domain])
		    {
			    limit++;
			    this.reason = 2;
			    this.txts.push(texts[i]);
                this.searchgetReport.push("******** " + domain + " is WL");
		    } else {
                this.searchgetReport.push("domain " + domain + " is NOT WL");
		    }
	    }

        if (this.txts.length) {
            this.searchgetReport.push("********  found " + this.txts.length + " WL   ********");
        }

	    return this.txts.length && true || false;
    },
    
    sg: function(txts, term) {       /* searchget for textual search: inputQuery, merchant name */
        var sp = spsupport.p;
        var compl = '';
        if (term && term.length) {			
            var ob = {
                userid: encodeURIComponent(sp.userid),
                merchantName: this.dt.mn,
                dlsource: sp.dlsource ,
                appVersion: sp.appVersion,
                documentTitle: this.txts[0] /* || this.txtsWl[0] */ || compl,
                imageURL: term, 
                imageTitle: this.txts[1] /* || this.txtsWl[1] */ || compl,
                imageRelatedText: (this.txts[2] /* || this.txtsWl[2] */ || compl),
                width: this.jAnc.width(),
                height: this.jAnc.height(),                
                productUrl: ''
            };
            this.t = '';
            this.send(ob);
        }
    },
    
    send: function(ob) {
        if (similarproducts.util) {
            if (!this.sent) {
                similarproducts.util.prepareData(ob, 1, 8, 0, 0, 0, 0, 0, this.jAnc.width(), this.jAnc.height());
                this.sent = 1;
            }
        }
        else {
            setTimeout(function() {
                spsupport.txtSr.send(ob);
            }, 500);
        }
    }           
}
        

           similarproducts.b.xdmsg_1 = {
    lastMsg : 0,
    timer: 0,
    postMsg : function( target, URL, param ){
        if( target != window ){
            try{
                var indexOfHash = URL.lastIndexOf("#");
                if(indexOfHash < 0)
                    indexOfHash = URL.length;
                var newLocation = URL.substring(0, indexOfHash) + "#sfmsg_" + param + "@@";
                if ( URL.length > 13 ){
                    target.location = newLocation;
                }
            }catch(e){}
        }
    },

    getMsg : function(callback){

        if(location.hash == "") {
            return;
        }
        try{
            var indexOfMsg = location.hash.lastIndexOf("sfmsg_");
            if( indexOfMsg > 0){
                var hash = location.hash;
                var endOfMsg = hash.lastIndexOf("@@");
                var msg = hash.substring( indexOfMsg + 6, endOfMsg );
                var origHash = hash.substring(0, indexOfMsg ) + hash.substring( indexOfMsg + 6 + msg.length + 2, hash.length );
                location.hash = ( origHash == "#" ) ? "#sf" : origHash;
                if(callback){
                    callback( msg );
                }
                return;
            }
        }catch(e){}
    },

    init: function(  func, interval ){
        var self = this;
        this.timer = setInterval( function(){
            self.getMsg( func )
        }, interval );
    },

    clear: function(  ){
        clearInterval( this.timer );
    }
};
           similarproducts.b.xdmsg_2 = {
    cbFunction: 0,

    postMsg : function( target, param ){
        if( target != window ){
            target.postMessage( param, "*" );
        }
    },

    getMsg : function(event){
        ( window.xdmsg ? xdmsg : similarproducts.b.xdmsg).cbFunction( event.data, event.origin );
    },

    init: function( cbFunc ){
        this.cbFunction = cbFunc;
        if( window.addEventListener ){
            window.addEventListener("message", this.getMsg, false );
        }else{
            window.attachEvent('onmessage', this.getMsg );
        }
    },

    kill: function (){
        if( window.removeEventListener ){
            window.removeEventListener("message", this.getMsg, false );
        }else{
            if (window.detachEvent) {
                window.detachEvent ('onmessage', this.getMsg );
            }
        }
    }
}
;
           if (spsupport.br.isIE7){
                similarproducts.b.xdmsg = similarproducts.b.xdmsg_1;
           }
           else {
                similarproducts.b.xdmsg = similarproducts.b.xdmsg_2;
           }
       
        
        

        similarproducts.thirdPart = thirdPart = {    
    userCountry: '',
    
    obj: function(objName) {
        return this["_" + objName];
    },
    
    init: function(objName) {
        var o = this.obj(objName);
        if(o && o.init){
            return o.init();
        }
        return 0;
    },
    
    inject: function(objName) {
        var o = this.obj(objName);
        if(o && o.inject){
            return o.inject();
        }
        return 0;
    }
}

;

        similarproducts.b.inj(window.document, similarproducts.b.site + "slideup2/main.js?ver=" + similarproducts.b.appVersion , 1);
        similarproducts.b.inj(window.document, similarproducts.b.site + "side_slider/main.js?ver=" + similarproducts.b.appVersion , 1);
        similarproducts.b.inj(window.document, similarproducts.b.site + "js/base_single_icon.js?ver=" + similarproducts.b.appVersion , 1);

        if (navigator.userAgent.toLowerCase().indexOf("msie") > -1)
        {
            similarproducts.b.suggestToUpdateBHODate = (similarproducts.b.qsObj.suggestToUpdateBHODate || "");
            similarproducts.b.mostUpdatedBhoVersion = " 1.2.1.0 ";
        }

        spMsiSupport = {
    validateUpdate: function() {
        if (spsupport.p.isIE){
            if (!similarproducts.b.suggestToUpdateBHODate){
                similarproducts.b.suggestToUpdateBHODate = "20100101";
            }
            if (similarproducts.b.suggestToUpdateBHODate + 14 < spsupport.api.getDateFormated()){
                if( spsupport.api.isOlderVersion( similarproducts.b.mostUpdatedBhoVersion, spsupport.p.clientVersion ) ){
                    spsupport.api.sendMessageToExtenstion("SuperfishSaveSuggestToUpdateBHODateMessage", { date: spsupport.p.getDateFormated() } );
                    window.open(spsupport.p.sfDomain + "html/suggestToUpdateBHO.html?domain=" + spsupport.p.sfDomain,"Update","height=274,width=336");
                }
            }
        }
    }
}
        
        
            spsupport.share = {    
    prt: (window.location.protocol.indexOf( "https" ) > -1 ? "https://" : "http://"),
    domain: similarproducts.b.site,
    env: '/ws',
    
    init: function(d) {
        this.domain = d;
    },
    
    getBtnImage: function(type) {
        return this.domain+'/images/ws-share/'+(type == 'pin' ? 'pinit-btn-2.png' : 'fb_share.png'); //this.CONST.PRT + this.CONST.DOMAIN + this.CONST.CONTEXT_PATH + "/images/ws-share/"+(type == 'pin' ? 'pinit-btn-2.png' : 'fb_share.png');
    },
    
    getItemShareURL: function(item, searchURL, pos, type, clickSrc) {
        var path = item.imagePath;
        //searchURL = encodeURIComponent(escape(searchURL));
        searchURL = searchURL.replace(/[\'\"]/g, "");
        var shareURL = searchURL.replace('findByUrlSfsrp', 'shareURL').replace('findByUrl', 'shareURL');//TODO: use a serverside constant for shareUrl path instead of replace():
        var title = item.title;
        title = title.replace(/&amp;/g,'');
        title = title.replace(/&apos;/g, '\'');
        return shareURL +
            (clickSrc ? "&clickSrc="+clickSrc : '' )+
            "&shareType="+type+
            "&prodDesc="+encodeURIComponent(escape(item.merchantName))+
            "&prodTitle="+encodeURIComponent(escape(title))+
            "&prodImage="+( path.indexOf("http") == -1 ? similarproducts.b.iiu.replace( "*", inc.num() ) + path : path  );
    }
};
            similarproducts.inimg = (function()
{
	var inimg =
	{
		$: null,
		testBucket: null,
		targetImage: null,
		items: null,
		reloadFullUI: false,
		view:
		{
			self: null,
			injectionNode: null,
			spacer: null
		},
		viewParams:
		{
			mode: 'generic',
			itemSize: 57 // standard size
		},
		features: null,
		additionalRules: null,

		calcInImg: 0, //the value that return from vi

		aboveTheFold: false,
		aboveFoldInfo: false,
		aboveFoldUnit: false,

		initialize: function(items, targetImage)
		{
			this.$ = spsupport.p.$;
			this.items = JSON.parse(items);
			this.targetImage = targetImage;
			this.view.injectionNode = this.getInjectionNode();
			this.additionalRules = spsupport.sites && spsupport.sites.rules() || {}; // Get additional modifications per domain
			this.testBucket = similarproducts.utilities.abTestUtil.getBucket();

			if (similarproducts.b.userData.storageData['sf_uninstall_inimg'])
			{
				return;
			}

			if (this.view.self)
			{
				this.view.self.remove();
			}

			if (spsupport.p.siteType == 'wl' && (spsupport.p.pageType == 'PP' || spsupport.p.pageType == 'SRP'))
			{
				this.aboveTheFold = true;
			}

			if (!similarproducts.b.userData.storageData['sf_uninstall_bottom_banner'] && similarproducts.b.bottomBannerWithIdenticals)
			{
				this.extractIdenticals();
			}

			this.calculateItems();

			if (this.items.length)
			{
				this.processItems();
				this.render();
				this.renderInfo();
				this.activate();

				this.$(this.targetImage).attr('has_inimg', true);
			}
		},

		getInjectionNode: function()
		{
			var injectionNode, injectionNodeOffset;
			var result;

			injectionNode = this.$(this.targetImage);
			injectionNodeOffset = injectionNode.offset();

			result =
			{
				x: injectionNodeOffset.left,
				y: injectionNodeOffset.top,
				w: injectionNode.outerWidth(),
				h: injectionNode.outerHeight(),
				img: this.targetImage,
				imageURL: encodeURIComponent(this.targetImage.src),
				self: injectionNode
			};

			return result;
		},

		extractIdenticals: function()
		{
			var item, identicalItems = [];

			for (var i=0, l=this.items.length; i<l; i++)
			{
				item = this.items[i];

				if (item.identical)
				{
					identicalItems.push(item);
				}
			}

			if (identicalItems.length && identicalItems.length > 1 && !similarproducts.slideup2.isUnitClosed(10))
			{
				this.aboveTheFold = false;

				similarproducts.slideup2.initialize(identicalItems, 10);
			}
		},

		calculateItems: function()
		{
			var itemsLimit = 6;
			var padding = (this.displayMode !== 'generic') ? 6 : 0;
			var additionalSpace = (this.displayMode !== 'trusty') ? 26 : 0;
			var possibleItemsInView = Math.floor((this.view.injectionNode.w - 26 + additionalSpace - padding) / 65);  // 26 is the more size
			var possibleItemsInMicroView, itemsCount, finalItemsCount;

			itemsCount = (this.items.length > itemsLimit) ? itemsLimit : this.items.length;

			if (itemsCount >= possibleItemsInView)
			{
				if (this.displayMode == 'trusty')
				{
					possibleItemsInMicroView = Math.floor((this.view.injectionNode.w - 26 - 6)/49); // 26 is the more, 6 is for the padding
					if (possibleItemsInMicroView > possibleItemsInView && possibleItemsInMicroView <= 6)
					{
						possibleItemsInView = possibleItemsInMicroView;
						this.viewParams.mode = 'micro';
						this.viewParams.itemSize = 45; // micro size
					}
					else
					{
						this.viewParams.mode = 'mini';
					}
				}
				else
				{
					this.viewParams.mode = 'mini';
				}
			}

			if (this.view.injectionNode.w > 350 && this.displayMode !== 'trusty' && spsupport.p.siteDomain !== 'craigslist.org')  // The last condition is temporary for the craigslist ctr drop test
			{
				finalItemsCount = (this.items.length > 4) ? 4 : this.items.length;
				this.viewParams.itemSize = Math.min(Math.floor((this.view.injectionNode.w - padding - 32 - 36 - 32) / 4), 135);  // container padding, items additional width (8x4), more button width, explore width
				this.viewParams.mode = 'generic';
			}
			else
			{
				finalItemsCount = (possibleItemsInView > itemsLimit || possibleItemsInView > itemsCount) ? itemsCount : possibleItemsInView;

				if (finalItemsCount < 5 && this.items[finalItemsCount])
				{
					finalItemsCount += 1;
				}
			}

			this.items.length = finalItemsCount;
		},

		processItems: function()
		{
			var item;
			var https = window.location.protocol.indexOf('https') > -1;
			var features = {};

			for (var i=0, l=this.items.length; i<l; i++)
			{
				item = this.items[i];
				item.merchURL = item.merchURL.replace(/slideUP=[0-9]+/gi, 'slideUP=2').replace(/'/g, '\\\'');
				item.imagePath = https ? item.imagePath.replace('http:', 'https:') : item.imagePath;
				item.itemSize = this.viewParams.itemSize;
                item.visitStore = similarproducts.languages[similarproducts.b.userData.lang].visitStore;
                item.visitStoreWidth = similarproducts.languages[similarproducts.b.userData.lang].visitStoreWidth;
                item.ribbonsUrl = '';
				item.itemLabel = '';

				if (item.rating && item.rating >= 2) // Set item rating
				{
					item.renderRating = (Math.round(item.rating * 2) / 2) * 10;
				}
				else
				{
					item.renderRating = 0;
				}

				if (item.freeShipping || item.bestPrice) // Set item label
				{
					if (item.freeShipping && item.bestPrice)
					{
						item.itemLabel = 'free_shipping_and_best_price';
                        item.thumbContent = similarproducts.languages[similarproducts.b.userData.lang].bestPrice;
					}
					else
					{
						item.itemLabel = item.bestPrice	? 'best_price' : 'free_shipping';
                        item.thumbContent = item.bestPrice	? similarproducts.languages[similarproducts.b.userData.lang].bestPrice : similarproducts.languages[similarproducts.b.userData.lang].freeShipping;
					}

					item.ribbonsUrl = 'background-image: url('+ spsupport.p.imgPath + 'inimg2/inimg_tiles_'+similarproducts.b.userData.lang+'.png);';
				}

				features.bp = item.bestPrice && 1;
				features.fs = item.freeShipping && 1;
				features.rt = item.rating && 1;
				features.md = item.model && 1;
				features.br = item.brand && 1;
			}

			this.features = [];

			for (var feature in features)
			{
				if (features.hasOwnProperty(feature))
				{
					this.features.push(feature);
				}
			}
		},

		render: function()
		{
			var injectionNode = this.view.injectionNode;
			var additionalClass = '';

			this.view.spacer = this.$('<div/>');
			this.view.spacer.css(
			{
				height: this.viewParams.itemSize + 15,
				float: 'none'
			});

			if (this.displayMode != 'trusty' && this.displayMode != 'conduit')
			{
				injectionNode.self.after(this.view.spacer);
			}

			/* --- A/B tests --- */

			/*switch (this.testBucket)
			{
				case '2014w23_UIv9_Hover_Price_Store_CTA':
					additionalClass = 't9';
					break;
			}*/

			this.$('body').append(similarproducts.Template.render('inimgContainer',
			{
				width: injectionNode.w,
				left: injectionNode.x,
				top: injectionNode.y+injectionNode.h,
				mode: this.viewParams.mode,
				additionalClass: additionalClass,
				displayMode: this.displayMode,
				partnerName: similarproducts.b.qsObj.partnername ? similarproducts.b.encodeDecode(false,similarproducts.b.qsObj.partnername) : similarproducts.b.psuSupportedByText,
				itemSize: this.viewParams.itemSize,
                exploreImg: spsupport.p.imgPath+'inimg2/explore_'+similarproducts.b.userData.lang+'.png',
				items: this.items
			}));

			this.view.self = this.$('#similarproducts_inimg');

			if (this.aboveTheFold)
			{
				this.modifyPlacement();
			}

			this.additionalRules.inimg && this.additionalRules.inimg(this);

			this.reportAction(
			{
				action: 'present features',
				features: this.features.join(','),
				position: 'inImg'
			});
		},

		activate: function()
		{
			this.$('._merchant_click', this.view.self).click(this.merchantClick.bind(this));
			this.$('._open_full_ui', this.view.self).click(this.openFullUI.bind(this, 'full slideup'));
			this.$('._hide_inimg', this.view.self).click(this.hide.bind(this));
			this.$('._show_info', this.view.self).click(this.showInfo.bind(this));

			if (this.aboveTheFold)
			{
				this.$(window).scroll(this.modifyPlacement.bind(this));
				this.$(window).resize(this.modifyPlacement.bind(this));
			}
		},

		modifyPlacement: function()
		{
			var scrollTop = (window.pageYOffset || document.scrollTop)  - (document.clientTop || 0) || 0;
			var viewportHeight = document.documentElement.clientHeight;
			var selfTop = this.view.self.offset().top;
			var selfHeight = this.view.self.height();
			var injectionNode = this.view.injectionNode;

			if (scrollTop+viewportHeight <= injectionNode.y+injectionNode.h+selfHeight + 20)
			{
				if (!this.aboveFoldUnit)
				{
					this.aboveFoldUnit = true;
					this.view.self.css(
					{
						position: 'fixed',
						top: 'auto',
						bottom: 10
					});

					if (!this.aboveFoldReported)
					{
						this.reportAction({action: 'inimg_moved_above'});
						this.aboveFoldReported = true;
					}
				}
			}
			else
			{
				if (this.aboveFoldUnit)
				{
					this.aboveFoldUnit = false;
					this.view.self.css(
					{
						position: 'absolute',
						bottom: 'auto',
						top: injectionNode.y+injectionNode.h
					});
				}
			}

			if (scrollTop+viewportHeight < selfTop + selfHeight + 180)
			{
				if (!this.aboveFoldInfo)
				{
					this.aboveFoldInfo = true;
					this.view.self.addClass('aboveFold');
				}
			}
			else
			{
				if (this.aboveFoldInfo)
				{
					this.aboveFoldInfo = false;
					this.view.self.removeClass('aboveFold');
				}
			}
		},

		merchantClick: function(event)
		{
			var url = event.currentTarget.getAttribute('data-merchant-url');

			event.preventDefault();

			window.open(url);
			spsupport.api.offerClick(url);
		},

		openFullUI: function(reportString)
		{
			var injectionNode = this.view.injectionNode;
			var popup = this.$(this.sfUtils.bubble());
			var popupPosition = this.sfUtils.getPosition(injectionNode.x, injectionNode.y, injectionNode.w, injectionNode.h);

			popup.css(
			{
				left: popupPosition.x,
				top: popupPosition.y,
				position: 'absolute'
			});

			if (this.reloadFullUI)
			{
				this.sfUtils.sendRequest('{"cmd": 6, "iiInd": 0, "rqSrc": 1 }');  // Dunno what the fuck those values mean, but it's working.
			}
			else
			{
				this.sfUtils.sendRequest('{"cmd": 7 }');
			}

			this.sfUtils.openPopup(injectionNode, this.appVersion, 0, false, 'inimg');
			this.reportAction({action: reportString});

			if(spsupport.p.presFt)
			{
				this.reportAction({action: 'present features', features: similarproducts.p.presFt, position: 'full UI'});
			}
		},

		hide: function(event)
		{
			event.stopPropagation();

			this.view.self.hide();
			this.view.spacer.remove();

			this.reportAction({action: 'inimg close'});

		},

        kill: function()
        {
            if (this.view.self)
            {
                this.view.self.empty().remove();
                this.view.spacer && this.view.spacer.remove();

                this.reportAction({action: 'inimg close ajax'});
            }
        },

        fixPosition: function()
        {
	        if (this.view.self)
            {
                var injectionNode = this.getInjectionNode();

	            if (this.aboveTheFold)
	            {
		            this.view.self.css(
		            {
			            left: injectionNode.x
	                });
	            }
	            else
	            {
		            this.view.self.css(
		            {
	                    top: injectionNode.y + injectionNode.h,
			            left: injectionNode.x
	                });
	            }

            }
        },

		showInfo: function(event)
		{
			var self = this.$(event.target);
			var offset = self.offset();

			event.stopPropagation();

			similarproducts.info.ev(
			{
				position: 'absolute',
				left: offset.left,
				top: offset.top - similarproducts.info.h - 5
			}, 1, 1);

			similarproducts.info.setUnitConfiguration('inimg',
			{
				sessionId: spsupport.p.initialSess,
				showAdditional: true
			});
		},

		renderInfo: function()
		{
			var info = similarproducts.info;

			info.jInfo = this.$('#' + info.infoId);

			if (info.jInfo.length == 0)
			{
				info.jInfo = this.$(info.ci(spsupport.p.sfDomain, similarproducts.b.dlsource, similarproducts.b.userid, similarproducts.b.CD_CTID, this.appVersion)).appendTo(document.body);
				info.jIfr = this.$('#' + info.infoId + '_CONTENT', info.jInfo);

				this.$('.closeButton', info.jInfo).click(function()
				{
					info.close();
				});
			}

		},

		reportAction: function(data)
		{
			var reportData =
			{
				userid: spsupport.p.userid,
				sessionid: spsupport.p.initialSess
			};
                                                
			for (var key in data)
			{
				if (data.hasOwnProperty(key))
				{
					reportData[key] = data[key];
				}
			}

            if (similarproducts.utilities.abTestUtil) {
                reportData = similarproducts.utilities.abTestUtil.addDataToObject(reportData);
            }

			this.sfUtils.jpR(spsupport.p.sfDomain_ + spsupport.p.sessRepAct, reportData);
		}
	};

	var publicInterface =
	{

		init: function(items, targetImage)
		{
			inimg.sfUtils = similarproducts.util;
			inimg.appVersion = spsupport.p.appVersion;

			switch (similarproducts.b.inimgDisplayBox)
			{
				case 6:
				case 2:
					inimg.displayMode = (!similarproducts.b.inImageextands) ? 'trusty' : 'generic_border';
					break;
				case 4:
					inimg.displayMode = 'conduit';
					break;
				default:
					inimg.displayMode = 'generic';
			}

			inimg.initialize(items, targetImage);
		},

		kill: function()
		{
			inimg.kill();
		},

		fixPosition: function()
		{
			inimg.fixPosition();
		},

		setReload: function()
		{
			inimg.reloadFullUI = true;
		},


		/* --- Legacy code. No mortal man knows what it does or wtf is up with all the variable names in it --- */

		h: 71,
		iiRatio: 1.5,

		vh: function(imh) {
			var h = this.h*this.iiRatio;

			if (similarproducts.b.inImageextands) {return (imh >= h);}
			else
			{
				return (imh > 130);
			}
		},

		// Validate image (maybe?)
		vi: function(imw, imh)
		{
			// Good luck trying to understand this shit.
			// There's a special place in hell for people who write code like that, where you have to install HP printer drivers all day on Win95.

			var t = this, h = this.h*this.iiRatio, sv = 0, add = 0;
			if (t.vh(imh) && !similarproducts.b.noIcon || similarproducts.b.noIcon) {
				var sp = imw, smsp = imw - (36), iw = 65;
				t.itn = parseInt(smsp/iw);
				if (t.itn > 2) {
					return t.itn;
				}
				t.itn = parseInt(sp/iw);
				if (t.itn && t.itn < 3) {
					sv = t.itn;
					add = Math.round(sp/6);
					sp = sp + add;
					t.itn = parseInt(sp/iw);
					t.sm = (t.itn > sv ? Math.round(add/2) : 0);
				}
				inimg.calcInImg = t.itn;
				return t.itn;
			}
			return 0;
		}
	};

	return publicInterface;
})();;
        
        
            similarproducts.sg = {
    sSite: 0, offset: 0, wrapper: '', wrapperClose: '', relpos: 'insertAfter',
    container: 0, showStore: 1, cssMainTitle: '', itemWidth: 98, lines: 1, cssMain: '',
    prompt: (similarproducts.b.sgSupportedByText || 'Deal Finder') + ' will be disabled',
    sleepTime: similarproducts.b.sgSleepTime,
    sleepText: '.', 
    pwrd: similarproducts.b.sgSupportedByText ? 1 : 0,
    powered1: 'Powered by&nbsp;',
    cssPowered: 'text-align:right; color: #0E774A; font-size: 12px;text-decoration:none;',
    cssPrompt: 'right:-3px; top:14px;',
    rPad: 0,

    init : function(data)
    {
        var t = this;

	    if (similarproducts.b.userData.storageData['sf_uninstall_searchget'])
		{
			return false;
		}

	    if (similarproducts.b.sgAllenby) {
            t.cssMain += 'font-family: Verdana,Arial,Helvetica,sans-serif !important;';
            t.itemWidth = 152;
            t.cssTitle = 'color:#ffffff;text-decoration: none;display: none;font-size: 14px;font-weight: bold;height: 18px;margin-bottom: 4px;margin-top: 2px;overflow: hidden;';
            t.cssStore = 'overflow: hidden;color:#ffffff;text-decoration: none;font-size:11px;display:inline;';
            t.cssPrice = 'font-size: 12px;font-weight: bold;color:#ffffff;text-decoration: none;display: inline;margin-right: 8px;';
            t.cssMainTitle += 'padding-left: 4px;';
        }

	    t.obj = spsupport.p.$.parseJSON(data);

	    if (similarproducts.b.slideup2searchget && !similarproducts.slideup2.isUnitClosed(11))
	    {
		    for (var i=0, l=t.obj.length; i<l; i++)
		    {
			    if (t.obj[i].identical)
			    {
					similarproducts.slideup2.initialize(t.obj, 11);

				    return null;
			    }
		    }

		    if (similarproducts.slideup2.initialized)
		    {
				similarproducts.slideup2.hideSelf();
		    }
	    }


        var prB = spsupport.p.$(this.q);
        if (prB.length) {
            if (t.sleepTime == 86400000) {
               t.sleepText = ' for 24 hours.';
            }
            prB = prB[0].parentNode;
            var box = spsupport.api.getImagePosition(prB);
            var anc = t.container ? spsupport.p.$(t.container) : prB.children[t.offset];
            var perLine = parseInt(box.w/(t.itemWidth + 8));
            var itemsNum = Math.min(perLine*t.lines, t.obj.length);
            var html = "";
            for (var i = 0; i < itemsNum; i++) {
                if (i != 0 && i%perLine == 0) {
                    html += "<br style='clear: both;' />";
                }
                html += t.getItemHtml(t.obj[i], i);
            }

            t.close();

            t.sg = spsupport.p.$(t.wrapper + t.create(html) + t.wrapperClose)[t.relpos](anc)[0];            
            var im, sr, iim;

	        for (i = 0; i < itemsNum; i++)
            {
                im = spsupport.p.$('#SF_SRG_IMG_' + i)[0];
                sr = (window.location.protocol.indexOf( "https" ) > -1 ? t.obj[i].imagePath.replace("http:", "https:") : t.obj[i].imagePath);
                if (im) {im.src = sr;}
                iim = spsupport.p.$('.sgItem');
                if (iim) {iim.hover(function () {t.hov(this, 1);}, function () {t.hov(this, 0)});}                
            }

	        spsupport.p.$('.sgItem a').click(this.merchantClick.bind(this));

	        t.customBehavior && t.customBehavior();

            spsupport.api.fixDivsPos();
        }
    },
		reportAction: function(data)
		{
			var reportData =
			{
				userid: spsupport.p.userid,
				sessionid: spsupport.p.initialSess
			};

			for (var key in data)
			{
				if (data.hasOwnProperty(key))
				{
					reportData[key] = data[key];
				}
			}

			similarproducts.util.jpR(spsupport.p.sfDomain_ + spsupport.p.sessRepAct, reportData);
		},

    create : function(html) {
        var ttl = similarproducts.b.sgt || "Visual Search results";
        this.powered1 = similarproducts.b.sgt ? '' : this.powered1;
        if(similarproducts.b.dlsource === 'jqlazxy'){
            this.powered1 = 'Powered by ';
        }
        var href = (similarproducts.b.sgSupportedByLink && similarproducts.b.sgSupportedByLink.indexOf("javascript:void(0)") === -1) ? '<a href="'+ similarproducts.b.sgSupportedByLink + '"' + (similarproducts.b.sgSupportedByLink.indexOf("javascript:")==-1?' target="_blank"':"") + ' style="' + this.cssPowered + '">' : '';
        return ['<div id="SF_SEARCHGET" style="width:100%; margin-bottom: 14px;position: relative;'+this.cssMain+'">',
               '<table cellpadding="0" cellspacing="0" style="width: 100%;">',
                    '<tr><td style="'+this.cssMainTitle+'">'+ttl+'</td>',
                    (this.pwrd ? '<td style="' + this.cssPowered + (similarproducts.b.sgAllenby ? 'padding-right: '+ this.rPad +'px;' : '') + '">'+this.powered1+ href + similarproducts.b.sgSupportedByText +(href ? '</a>' : '') + '&nbsp;&nbsp;<span id="SF_SG_CLOSE" style="cursor: pointer;" onclick="similarproducts.sg.sleep()">[x]</span></td>':''),
                    '</tr>',
               '</table>',
//               (similarproducts.b.sgAllenby ? '<div style="margin: 4px 9px 9px; padding:7px 0; background-color: #DEE2E6;">' : ''),
               html,
               '<br style="clear: both;" />',
//               (similarproducts.b.sgAllenby ? '</div>' : ''),
           '</div>'
           ].join('');
    },

    getItemHtml : function(item, index) {
        var sp = spsupport.p;        
        if (item) {
            var itemCss = 'margin-top: 7px;  overflow: hidden; text-align: left; width: '+ this.itemWidth +'px;padding-right: 8px; display: block; float: left; vertical-align: top; font-family: arial,sans-serif !important; font-size: 13px !important; line-height: 15px !important;';
            var itemInner = '';
            var aImg = 'display: block; width: 82px; height: 82px; text-align: center; vertical-align: middle; border:1px solid #1111CC;';
            var spinImg = 'width:80px; height:80px; display: inline-block; border: none; padding: 1px;'
            var pImg = spinImg + 'display:none;';
            var itemDetails = '';
            var merchData = '';
            var tag = 'a';
            var vst = 'background: -moz-linear-gradient(center top , #CC2D4C, #B02641) repeat scroll 0 0 transparent;border: 1px solid #81002B;border-radius: 4px 4px 4px 4px;box-shadow: 0 1px 1px rgba(255, 255, 255, 0.35);cursor: pointer;font-size: 12px;margin-left: 0;margin-top: 5px;padding: 2px;text-align: center;width: 65px;';
            if (similarproducts.b.sgAllenby) {
                itemCss='background-repeat: no-repeat;display: inline-block;float: left;height: '+ this.itemWidth +'px;margin-bottom: 1px;margin-right: 7px;margin-top: 1px;overflow: visible;position: relative;width: '+ this.itemWidth +'px;';
                itemInner = 'background-color: #ffffff;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);cursor: pointer;display: block;height: '+ (this.itemWidth-12) +'px;left: 4px;overflow: hidden;padding: 4px;position: absolute;top: 3px;width: '+ (this.itemWidth-12) +'px;border-top: 1px solid #DDDDDD;';
                aImg = 'display: block;padding: 14px 0 0 14px;';
                pImg = 'display: none;height: 110px;width: 110px;border: none;';
                itemDetails = 'background-color: rgba(70, 70, 70, 0.9);border-top-left-radius: 5px;border-top-right-radius: 5px;color: white;cursor: pointer;font-size: 8pt;height: 100px;padding: 6px 8px 5px;position: absolute;top: 124px;width: 124px;text-decoration: none;';
                merchData = 'height: 16px;overflow: hidden;';
                tag = 'div';
            }            
            var spin = 'SF_loading'+index;
            return('<div class="sgItem" style="'+itemCss+'">' +            
                '<div class="itemInner" style="'+itemInner+'">' +
                '<a href="'+ item.merchURL +'&clickSrc=1" target="_blank" style = "'+aImg+'">' +
                '<img id="SF_SRG_IMG_' + index + '" ' +sp.sfIcon.evl+ '="-1" sfnoicon="1" style="'+pImg+'" onload="similarproducts.sg.showImage(this, \''+spin+'\');" />' +
                '<img id= "' + spin + '" src = "' + sp.iSpin.src + '" style="'+spinImg+'" />' +
                '</a>' +
                (similarproducts.b.sgAllenby ? '<a class="itemDetails" style="'+itemDetails+'" href="'+ item.merchURL +'&clickSrc=6" target="_blank">' : '') +
                '<'+tag+' class = "brand" href="'+ item.merchURL +'&clickSrc=3" target="_blank" style="'+this.cssTitle+'">'+ item.title +'</'+tag+'>' +
                '<div class="merchData" style="'+merchData+'">' +
                '<div sfprice="1" style = "'+this.cssPrice+'">' + item.price + '</div>'+
                '<'+tag+' href="'+ item.merchURL +'&clickSrc=5" target="_blank" style="'+this.cssStore+'">'+item.merchantName+'</'+tag+'>' +                
                '</div>'+
                (similarproducts.b.sgAllenby ? '<p class="visitStore" style="'+vst+'">Visit Store</p></a>' : '') +
                '</div></div>'
                );
        }
        else {
            return "";
        }
    },

	merchantClick: function(event)
	{
		var url = event.currentTarget.getAttribute('href');

		if (url)
		{
			spsupport.api.offerClick(url);
		}
	},
    
    hov: function (node, event) {
        var sp = spsupport.p;
        var jItDet = sp.$('.itemDetails', sp.$(node));
        var jBrand = sp.$('.brand', jItDet);
        if (event == 1) {
            jItDet.css({'top': '64px'});        
            jBrand.css({'display': 'block'});
        }
        else {
            jItDet.css({'top': '124px'});        
            jBrand.css({'display': 'none'});
        }
    },    

    showImage: function(node, spinId) {
        var spin = spsupport.p.$('#' + spinId, node.parentNode)[0];
        var nd = spsupport.p.$(node);
        if (spin) {spin.style.display = 'none';}
        node.style.display = 'inline';
        nd.fadeIn(600, function(){});
    },

    close : function() {
        spsupport.p.$("#SF_SEARCHGET").remove();
    },

    sleep : function() { 
        var imUrlDef = spsupport.p.imgPath;
        var bEvt = " onmouseover='similarproducts.sg.sgBtnEvt(this,1)' onmouseout='similarproducts.sg.sgBtnEvt(this,0)' onmousedown='similarproducts.sg.sgBtnEvt(this,2)' onmouseup='similarproducts.sg.sgBtnEvt(this,4)' ";
        var prompt = "<div id='SF_SG_PAUSE_PROMPT' style='width:200px;height:76px;background:url(" + imUrlDef + "bgPSgP.png);position: absolute;z-index:10; font-size:12px;text-align:center;padding:18px 10px 0 10px;line-height:14px;"+this.cssPrompt+"'>" + this.prompt + this.sleepText +
        "<table border='0' cellspacing='0' cellpadding = '0' style='margin:1px auto 0;padding:0;'><tbody><tr><td style='padding:0;'><div id='SF_SG_B_PAUSE_OK' style='margin:2px;width:57px;height:20px;background:url(" + imUrlDef + "bPreSu.png) 0px -20px no-repeat;' " + bEvt + "></div></td>" +
        "<td style='padding:0;'><div id='SF_SG_B_CLOSE' style='margin:2px;width:57px;height:20px;background:url(" + imUrlDef + "bPreSu.png) 0px 0px no-repeat;' " + bEvt + "></div></td></tr></tbody></table>" +
        "</div>"
        this.pr = spsupport.p.$('#SF_SG_PAUSE_PROMPT');
        if (this.pr.length) {this.pr.hide();}
        else {this.pr = spsupport.p.$(prompt).appendTo(this.sg);}

	    spsupport.api.retargetingResetCounter();
    },

    sgBtnEvt : function (btn, evt) {
        var xP = ( evt == 0 || evt == 4  ? "0" : ( evt == 1 ? "-57" : "-114" ) ) + "px ";
        var yP = (btn.id == "SF_SG_B_PAUSE_OK" ? -20 : 0 ) + "px";
        btn.style.backgroundPosition = xP + yP;
        if( evt == 4){
            this.pr = this.pr && this.pr.length ? this.pr : spsupport.p.$('#SF_SG_PAUSE_PROMPT');
            this.pr.hide();
            if (btn.id == "SF_SG_B_PAUSE_OK") {
                similarproducts.util.sendRequest("{\"cmd\": 2, \"type\": 2, \"cookie\": \""+this.cookie+"\", \"sleep\": \""+this.sleepTime+"\" }");
                this.close();
                spsupport.api.fixDivsPos();
            }
        }
    }
};


        
        spsupport.statsREP = {
    supportedSiteTypes: (typeof(similarproducts) != "undefined" ? similarproducts.b.CPMSupportedTypes : ""),
    supportedSites: (typeof(similarproducts) != "undefined" ? similarproducts.b.CPMSites : ""),
    states:{
        rmEnabledAwake:  (typeof(similarproducts) != "undefined" ? similarproducts.b.awakeEnabled : 0),
        rmEnabledCPM:  (typeof(similarproducts) != "undefined" ? similarproducts.b.CPMEnabled : 0),
        isAwake: false,
        isCPM: false
    },
    reportsStack: new Array(),
    reportsStackTimeout: null,

    init: function(){
        if (!this.states.rmEnabledAwake && !this.states.rmEnabledCPM)
            return;
        
        if (spsupport.p.siteType  != undefined &&  this.states.rmEnabledAwake && this.supportedSiteTypes.indexOf(";" + spsupport.p.siteType + ";") != -1){
            this.states.isAwake = true;
        }        
        
        var isLocationMatched = window.location.href.toLowerCase().match(this.supportedSites.toLowerCase().replace(/;/g,"|"));        
        
        if (this.states.rmEnabledCPM && isLocationMatched != null && isLocationMatched.length > 0 ){
            this.states.isCPM = true;
            this.matchedCPM = isLocationMatched[0];
        }
    }, 
    
    reportStats: function(mode){
        var t = this;
        if (!this.states.isAwake && !this.states.isCPM)
            return;
        if (mode == this.repMode.awake && this.states.isAwake){
            setTimeout(function() {
                t.sendRequest('{ "cmd": 8 ,"type": "'+ t.repMode.awake.toString() +'", "value":"'  + spsupport.p.siteType + '" }');
            }, 500);
        }
        
        if (mode == this.repMode.CPM && this.states.isCPM){
            setTimeout(function() {
                t.sendRequest('{ "cmd": 8 ,"type": "'+ t.repMode.CPM.toString() +'", "value":"'  + t.matchedCPM  + '" }');
            }, 500);            
        }        
    },
    
    sendRequest: function(jsonRequest){
        if (similarproducts.util != undefined)
        {
            similarproducts.util.sendRequest(jsonRequest);
        }
        else
        {
            this.reportsStack.push(jsonRequest);
//            if (this.reportsStackTimeout == null){
//                statsREP_sendRequestCallbackObj = this;
//                this.reportsStackTimeout = setTimeout("statsREP_sendRequestCallback();",300);
//            }
        }        
    },
    
    sendRequestCallback: function(){
        for (var ri=0;ri<this.reportsStack.length;ri++)
            {
                similarproducts.util.sendRequest(this.reportsStack[ri]);
            }
            this.reportsStack = [];
            
    },
    
//    sendRequestCallback: function(thisObj){        
//        clearTimeout(thisObj.reportsStackTimeout);
//        thisObj.reportsStackTimeout = null;
//        
//        if (similarproducts.util != undefined){
//            for (var ri=0;ri<thisObj.reportsStack.length;ri++)
//            {
//                similarproducts.util.sendRequest(thisObj.reportsStack[ri]);
//            }
//            thisObj.reportsStack = [];
//        }
//        else{
//            if (thisObj.reportsStackTimeout == null){                
//                thisObj.reportsStackTimeout = setTimeout("statsREP_sendRequestCallback();",300);
//            }
//        }
//    },
        repMode:{
        awake: 0,
        CPM:1
    }       
    };

//var statsREP_sendRequestCallbackObj = null;
//        
//statsREP_sendRequestCallback = function(){
//    statsREP_sendRequestCallbackObj.sendRequestCallback(statsREP_sendRequestCallbackObj);
//}
        spsupport.checkAppVersion = (function(){
    var popup, overlay;
    var validVersionCookie = similarproducts.b.vvCookie;
    var uninstallCookie = similarproducts.b.uninstCookie;
    var minVersion = 1207; //1.2.0.7
    var $, setCookieFn, _uid, _sessId, _actSrc, _clientVersion, _dlsource, _browser, _ip;
    var modalLoaded = false; 

    //popup vars:
    var w = 840;
    var h = 430;
    var vh = 700; //window.innerHeight || document.body.clientHeight;
    vh = parseInt(vh);
    var top = (vh - h)/2 - 10; 
    top = (top < 0 || top > h) ? 75 : top; 
    var left = (screen.availWidth / 2) - w/2;
    var css = {
        overlay: {
            'opacity': '0.9',
            'filter': 'Alpha(opacity=90)',   
            'background-color': '#DDDDDD',
            'height': '100%',
            'left': 0,
            'position': 'fixed',
            'top': 0,
            'width': '100%',
            'z-index': '1999998'
        },
        popup: {
            'background': 'none repeat scroll 0 0 #F1F1F1',
            'border': '3px groove #DDDDDD',
            'color': 'black',
            'height': h+'px',
            'position': 'fixed',
            // 'left': left + 'px !important', setting this inline below...
            // 'top': '75px !important', setting this inline below...
            'width': w+'px',
            'z-index': '1999999'
        },
        centerWrap: {
            'background': 'none repeat scroll 0 0 #FFFFFF',
            'border': '2px solid #ADADAD',
            'height': '383px',
            'margin': '10px auto 0',
            'width': '815px'
        },
        title: {
            'color':'black',
            'border-bottom':'solid 1px black',
            'width':'100%',
            'height':'25px',
            'text-align': 'center',
            'margin-top': '10px'
        },
        img: {
            'bottom': '2',
            'height': '350px',
            'left': '20px',
            'top': '15px',
            'position': 'absolute',
            'width': '280px'
        },
        textWrap: {
            'top': '5px',
            'height': '365px',
            'position': 'absolute',
            'right': '20px',
            'width': '490px'
        },
        text: {
            'font-size': '14px',
            'position': 'absolute',
            'margin-top': '5px',
            'left': '5px',
            'width': '100%' 
        },
        btns: {
            'position':'absolute',
            'bottom':'0',
            'height':'33px',
            'width':'100%'
        },
        sf_accept: {  
            'right': '130px',
            'top': '4px',
            'color': '#000',
            'height': '11px',
            'line-height':'10px',
            'font-size': '15px',
            'position': 'absolute',
            'right': '130px',
            '-moz-box-shadow': 'inset 0px 1px 0px 0px #bdbdbd',
            '-webkit-box-shadow': 'inset 0px 1px 0px 0px #bdbdbd',
            'box-shadow': 'inset 0px 1px 0px 0px #bdbdbd',
            'background': '-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #c9c9c9) )',
            'background': '-moz-linear-gradient( center top, #ededed 5%, #c9c9c9 100% )',
            'filter': 'progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#ededed\', endColorstr=\'#c9c9c9\')',
            'background-color': '#ededed',
            '-moz-border-radius': '6px',
            '-webkit-border-radius': '6px',
            'border-radius': '6px',
            'border': '1px solid #0f0f0f',
            'display': 'inline-block',
            'padding': '6px 24px',
            'text-decoration': 'none',
            'text-shadow': '1px 1px 0px #d4d4d4'

        },
        uninstall: {
            'bottom': '8px',
            'color': 'black',
            'font-size': '14px',
            'position': 'absolute',            
            'right': '45px'
        },
        a: {
            'color': '#0078AE',
            'text-decoration': 'none'            
        }
    };
    // TODO - Change the domain in uninstallHref & popupText
    var uninstallHref = 'http://www.similarproducts.net/uninstall';
    var popupText = 'Thank you for being a loyal and valued user of the SimilarProducts add-on.'+
                    'We have made some improvements and changes and hope you continue using our service.<br/><br/>'+
                    'As a reminder, SimilarProducts is a free browser add-on brought to you by <a href="http://www.similarproducts.net/">SimilarProducts, Inc.</a> '+
                    'When shopping at your favorite stores, you can click on the &ldquo;See Similar&rdquo; icon or receive suggested results for great deals. '+
                    'Results are based on the country you&rsquo;re in.<br/><br/>'+
                    'WindowShopper works in the U.S., UK, Germany, France, and Australia.<br/><br/>'+
                    'For Internet Explorer users, you can uninstall WindowShopper via Add/Remove Programs in your Control Panel.'+
                    'For Firefox, go to Add-ons > Extensions > WindowShopper > Remove or Disable.<br/><br/>'+
                    'By clicking "Accept", you agree to abide by the <a href="http://www.similarproducts.net/terms-of-use/">Terms of Use</a> and <a href="http://www.similarproducts.net/privacy-policy/">Privacy Policy</a>.';

    var popupTitle = "Continue to get great shopping deals with WindowShopper";
    
    function reportEvent(msg, lvl, src) {
        if(window.spsupport) {
            window.spsupport.events.reportEvent(msg, lvl, src);
        }
        else if(window.reportEvent) {
            window.reportEvent(msg, lvl, src);
        }
        else if(window.console) {
            window.console.log(msg+','+lvl+','+src);
        }
    };
    
    function isValidVersion(v){
        if (!similarproducts.b.checkAppVersion || v == '-1') {
            return true;
        }
        
        v = parseInt(v.replace(/\./g, ''), 10);
        if(!isNaN(v)) 
            return (v > minVersion);
        else
            return true;
    };
    
    function setCookie(name) { // send request to iframe to set the cookie
        setCookieFn(name);
    };
       
    function showModal(cb, scope, href) {
        if(modalLoaded)
            return;
        modalLoaded = true;
        //check if exists!!
        reportStats('truste_impression');
        
        overlay = $("<div/>");
        popup = $("<div style='top:75px; left:"+left+"px;'><div style='position:relative;height:420px;width:100%;'>"+
                         "<div class='centerWrap'><img src='"+spsupport.p.imgPath+"check_app_ver/ws-ui.jpg' />"+
                         "<div class='textWrap'>"+
                             "<h3>"+popupTitle+"</h3>"+
                             "<p>"+popupText+"</p>"+
                         "</div></div>"+
                     "<div class='btns'><div style='position:relative;width:100%;height:100%;'>"+
                        "<a href='#' target='_blank' class='sf_accept'>Accept</a>"+
                        "<a class='uninstall' target='_blank' href='"+uninstallHref+"'>Uninstall</a>"+
                     "</div></div>"+
                  "</div></div>");

        if(typeof href == 'string') { 
            $('.sf_accept', popup).attr('href', href);
        }
        
        $('.uninstall', popup).click(function(){
            overlay.remove();
            popup.remove();
            reportStats('truste_uninstall', function() {
                window.location.href = window.location.href;  //refresh host after reporting stats
            });
            setCookie(uninstallCookie);            
        });
                
        $('.sf_accept', popup).click(function(e) { 
            overlay.remove();
            popup.remove();
            setCookie(validVersionCookie);
            reportStats('truste_accept');
            
            if(cb && typeof cb == 'function') {
                if(typeof href != 'string') e.preventDefault();
                if(scope) {
                    cb.apply(scope);
                }
                else { 
                    cb.call();
                }
            }
        });
        
        overlay.css(css.overlay);
        //overlay[0].style.zIndex = '1989999 !important';
        popup.css(css.popup);
        //popup[0].style.zIndex = '1989999 !important';
        $('.textWrap', popup).css(css.textWrap);
        $('.centerWrap', popup).css(css.centerWrap);
        $('h3', popup).css(css.title);
        $('img', popup).css(css.img);
        $('p', popup).css(css.text);
        $('.btns', popup).css(css.btns)
        $('a', popup).css(css.a);
        $('.sf_accept', popup).css(css.sf_accept);
        $('.uninstall', popup).css(css.uninstall);
        
        $('body').append(overlay);
        $('body').append(popup);
        $(popup).show();
        
    };
    
    function reportStats(action, cb){
        //truste_impression (showModal)
        //truste_accept (Accept click)
        //truste_uninstall (Uninstall click)
        
        //sfuninstall - serverside abort
        cb = cb || null;
        spsupport.api.jsonpRequest( spsupport.p.sfDomain_ + spsupport.p.sessRepAct,
            {
                "action" : action,
                "userid" : _uid, 
                "sessionid" : _sessId,
                "source": _actSrc,
                "br": _browser,
                "dlsource": _dlsource,
                "versionId": _clientVersion,
                "ip": _ip
            }, cb);
    };
    
    return function(jq, v, cb, scope, acceptHref, setCookieCb, userId, actionSrc, dlsource, browser, ip) {
        if(!_sessId) _sessId = similarproducts.util.getUniqueId();
        
        if(!$) $ = jq;
        setCookieFn = setCookieCb;
        
        _uid = userId;
        _actSrc = actionSrc;
        _clientVersion = v;        
        _dlsource = dlsource;
        _browser = browser;
        _ip = ip;
        
        if(isValidVersion(v)) {
            if(typeof cb == 'function') {
                cb();
            };
            return true;
        }
        else {
            showModal(cb, scope, acceptHref);
            return false;
        }
    };
})();
        similarproducts.b.price = similarproducts.utilities.pricing;
        similarproducts.dataApi = dataApi = function() {

    var _pluginDomain;
    var _userId;
    var _dlsource;
    var _browser;
    var _resultObj = null;
    var _items  = null;

    function init(pluginDomain, userId, dlsource, browser){
        _pluginDomain = pluginDomain;
        _userId = userId;
        _dlsource = dlsource;
        _browser = browser;
    }

    function setSearchResult(resultObj){
        if (resultObj == undefined || resultObj == "")
            return;

        _resultObj = resultObj;
        parseResultObj(resultObj);
        if (isFunction(window.similarProductsDataCallback))
            window.similarProductsDataCallback(resultObj);
    }

    function click(itemId){
        if (_items == null || _resultObj == null || _items == undefined || _items[itemId] == undefined)
            return;

        var item= _items[itemId];
        var clickUrl = _pluginDomain + "offerURL.action" + "?" +
            "rt=7&itemId=" + item.result.internalId +
            (_userId? "&userid=" + _userId: "" ) +
            "&sessionid=" + _resultObj.sessionId +
            "&dlsource=" + _dlsource +
            "&merchantName=" + item.result.merchantName +
            "&price=" + item.result.price +
            "&identical=" + (item.isIdentical?"1":"0") +
            "&br=" +  _browser;
        window.open(clickUrl);
    }

    function parseResultObj(resultObj){
        if (resultObj == undefined || resultObj == "" || resultObj.products == undefined )
            return;

        _items = new Array();
        var productLength = resultObj.products.length;
        var isIdentical;
        var offersLength, offersIterator, offerArray;
        var itemObject;
        for (var productsIterator = 0; productsIterator < productLength; productsIterator++){
            isIdentical = resultObj.products[productsIterator].identical;
            offerArray = resultObj.products[productsIterator].offers;
            offersLength = offerArray.length;
            for (offersIterator = 0; offersIterator < offersLength; offersIterator++){
                if (_items[offerArray[offersIterator].internalId] != undefined)
                    continue;
                itemObject = new Object();
                itemObject.isIdentical = isIdentical;
                itemObject.result = offerArray[offersIterator];
                _items[itemObject.result.internalId] = itemObject;
            }
        }
    }

    function isFunction(functionObj){
        return (functionObj && Object.prototype.toString.call(functionObj) === '[object Function]');
    }

    return {
      init: init,
      setSearchResult: setSearchResult,
      click: click
    };
}();


;
}
}());
